File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/win_shortcut.cpython-310.pyc
Back
o ;j�D � @ s� d Z ddlZddlZddlZddlZddlZddlZddlm Z dZ ejj� � r.ddlZdZ e�e�ZdZddd d ddd �Zdd� Zdd� Z ddd�Z ddd�Z ddd�ZdS )a Execution module for creating shortcuts on Windows. Handles file shortcuts (`.lnk`) and url shortcuts (`.url`). Allows for the configuration of icons and hot keys on file shortcuts. Changing the icon and hot keys are unsupported for url shortcuts. .. versionadded:: 3005 � N)�CommandExecutionErrorFT�shortcut�Normal� Maximized� Minimized� � � )r r r r r r c C s0 t jj�� s t�d� dS tst�d� dS tS )z$ Make sure we're on Windows �1Shortcut module only available on Windows systems)Fr � Shortcut module requires pywin32)Fr )�salt�utils�platform� is_windows�log�debug� HAS_WIN32�__virtualname__� r r �M/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/win_shortcut.py�__virtual__, s r c C s� t j�| �s td| � ���| �d�s!t j�| �\}}td|� ���tjj� � �� t j�d�}|� | �}d}d}d}d}d} d} d}tjj�|j�} | �d�r�|j}|r[tjj�|�}nd| � �} t�| � t| ��|jro|j}|jru|j}|jr{|j}|jr�|j�d �\}} |r�tjj�|�}|jr�t|j } |jr�tjj�|j�}n|j}|||t| �|| || |d � W d � S 1 s�w Y dS )a� Gets the properties for a shortcut Args: path (str): The path to the shortcut. Must have a `.lnk` or `.url` file extension. Returns: dict: A dictionary containing all available properties for the specified shortcut CLI Example: .. code-block:: bash salt '*' shortcut.get path='C:\path\to\shortcut.lnk' �Shortcut not found: ��.lnkz.url�Invalid file extension: � WScript.Shell� r r zNot a valid shortcut: �,) � arguments�description�hot_key� icon_index� icon_location�path�target�window_style�working_dirN)�osr# �existsr �endswith�splitextr r �winapi�Com�win32com�client�Dispatch�CreateShortcut�expandZFullName� TargetPathr r � Arguments�Description�Hotkey�IconLocation�split�WindowStyle�WINDOW_STYLE�WorkingDirectory�int)r# �_�ext�shellr r r r r"