
    Jf                     >    d Z ddlZddlZddlmZ d Z G d d      Zy)z5
Creation of  Windows shortcuts.

Requires win32all.
    N)shellc                 <    t               }|j                  |        |S )zg
    Open an existing shortcut for reading.

    @return: The shortcut object
    @rtype: Shortcut
    )Shortcutload)filenamescs     R/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/twisted/python/shortcut.pyopenr
      s     
BGGHI    c                   6    e Zd ZdZ	 	 	 	 	 	 ddZd Zd Zd Zy)r   z
    A shortcut on Win32.
    Nc                    t        j                  t        j                  dt         j                  t        j
                        | _        |.| j                  t        j                  j                  |             || j                  |       || j                  |       |.| j                  t        j                  j                  |             |0| j                  t        j                  j                  |      |       yy)a  
        @param path: Location of the target
        @param arguments: If path points to an executable, optional arguments
                      to pass
        @param description: Human-readable description of target
        @param workingdir: Directory from which target is launched
        @param iconpath: Filename that contains an icon for the shortcut
        @param iconidx: If iconpath is set, optional index of the icon desired
        N)	pythoncomCoCreateInstancer   CLSID_ShellLinkCLSCTX_INPROC_SERVERIID_IShellLink_baseSetPathospathabspathSetArgumentsSetDescriptionSetWorkingDirectorySetIconLocation)selfr   	argumentsdescription
workingdiriconpathiconidxs          r	   __init__zShortcut.__init__"   s    $ //!!**  	

 LL./ i(",!$$RWW__Z%@A  !:GD  r   c                     | j                   j                  t        j                        j	                  t
        j                  j                  |             y)z1
        Read a shortcut file from disk.
        N)r   QueryInterfacer   IID_IPersistFileLoadr   r   r   r   r   s     r	   r   zShortcut.loadE   s7     	

!!)"<"<=BBGGOOH%	
r   c                     | j                   j                  t        j                        j	                  t
        j                  j                  |      d       y)z^
        Write the shortcut to disk.

        The file should be named something.lnk.
        r   N)r   r$   r   r%   Saver   r   r   r'   s     r	   savezShortcut.saveM   s9     	

!!)"<"<=BBGGOOH%q	
r   c                 .    t        | j                  |      S )N)getattrr   )r   names     r	   __getattr__zShortcut.__getattr__W   s    tzz4((r   )NNNNNr   )__name__
__module____qualname____doc__r"   r   r*   r.    r   r	   r   r      s1     !EF

)r   r   )r2   r   r   win32com.shellr   r
   r   r3   r   r	   <module>r5      s$   
 
   	;) ;)r   