
    c)                     F    d Z ddlmZ ddlZ G d de          Zd Zd ZdS )z"Windows command line manipulation.    )absolute_importNc                       e Zd ZdS )WindowsCommandLineExceptionN)__name__
__module____qualname__     Ilib/python3.11/site-packages/anaconda_project/internal/windows_cmdline.pyr   r      s        Dr
   r   c                    ddl m}m}m}m} ddlm}m}m} |j	        j
        }| ||          g|_         ||          |_        |j        j        }	|g|	_        ||	_         |d          }
 ||  ||
                    }|st          dt!          |           z             	 g }d}||
j        k     rs	 |                    t!          ||                              n9# t&          $ r,}d| z   dz   t!          |          z   }t          |          d }~ww xY w|dz  }||
j        k     s |	|           n#  |	|           w xY w|S )Nr   )windllc_intPOINTERbyref)LPCWSTRLPWSTRHLOCALz&Windows could not parse command line: zFWindows cannot represent this command line in its character encoding: z:    )ctypesr   r   r   r   ctypes.wintypesr   r   r   shell32CommandLineToArgvWargtypesrestypekernel32	LocalFreer   strvalueappendUnicodeEncodeError)commandr   r   r   r   r   r   r   r   r   argcargvresultiemessages                   r   windows_split_command_liner(      s   4444444444447777777777:#*GGENN";!()I II588DguuT{{33D c **RUXY`UaUa*abbb$*n 	;c$q'll++++% ; ; ;cfmmpttq66"1':::; FA $*n 	 		$		$Ms0   "D0 2(C D0 
D%'DDD0 0D=c                 j   t          |           dk    rt          d          | d                             d          rt          d| d         z             d| d         v r"d| d         v rt          d| d         z             | d         }d|v rd|z  }|dz   t          j        | dd	                   z   S )
a^  Combine an argv into a Windows command line.

    Note: this can throw on some args you might pass in, but it should not throw
    on args you got from windows_split_command_line, because those are args
    that are representable as a command line. In other words, we throw on args
    that windows_split_command_line won't be able to reproduce.
    r   z@Windows has no way to encode an empty arg list as a command line"z<Windows does not allow the first arg to start with a quote:  zEWindows does not allow the first arg to have both quotes and spaces: z"%s"r   N)lenr   
startswith
subprocesslist2cmdline)args	first_args     r   windows_join_command_liner2   5   s     4yyA~ n)*lmmm Aw# t **hkopqkr*rsss
d1g~ 3#a. 3 **q*.q'+2 3 3 	3QI
i 'Y&	s?Z4T!""X>>>>r
   )__doc__
__future__r   r.   	Exceptionr   r(   r2   r	   r
   r   <module>r6      s~    ) ( & & & & & &    	 	 	 	 	) 	 	 	     F? ? ? ? ?r
   