appdirs.pyc
1 o 2 6�Hc}` � @ sz d Z dZd�eee��ZddlZddlZejd dkZ e reZ 3 ej�d�rDddlZe� � d d Ze�d�r9dZne�d �rAd 4 ZndZnejZd4d d�Zd4dd�Zd4dd�Zd4dd�Zd5dd�Zd4dd�Zd5dd�ZG dd� de�Zdd� Zd d!� Zd"d#� Zd$d%� Zedkr�zddlZeZW n1 e y� z 5 dd&l!m"Z" eZW n e y� zddl#Z$eZW n e y� eZY nw Y nw Y nw e%d'k�r9d(Z&d)Z'd*Z(e)d+e � e)d,� ee&e'd-d.�Z*e(D ] Z+e)d/e+e,e*e+�f � q�e)d0� ee&e'�Z*e(D ] Z+e)d/e+e,e*e+�f � q�e)d1� ee&�Z*e(D ]Z+e)d/e+e,e*e+�f � �qe)d2� ee&dd3�Z*e(D ]Z+e)d/e+e,e*e+�f � �q*dS dS )6zyUtilities for determining application-specific dirs. 6 7 See <http://github.com/ActiveState/appdirs> for details and usage. 8 )� � � �.� Nr �java�Windows�win32ZMac�darwin�linux2Fc C s� t dkr/|du r 9 | }|rdpd}tj�t|��}| r.|dur'tj�||| �}n/tj�|| �}n't dkrCtj�d�}| rBtj�|| �}nt�dtj�d ��}| rVtj�|| �}| ra|ratj�||�}|S ) 10 aJ Return full path to the user-specific data dir for this application. 11 12 "appname" is the name of application. 13 If None, just the system directory is returned. 14 "appauthor" (only used on Windows) is the name of the 15 appauthor or distributing body for this application. Typically 16 it is the owning company name. This falls back to appname. You may 17 pass False to disable it. 18 "version" is an optional version path element to append to the 19 path. You might want to use this if you want multiple versions 20 of your app to be able to run independently. If used, this 21 would typically be "<major>.<minor>". 22 Only applied when appname is present. 23 "roaming" (boolean, default False) can be set True to use the Windows 24 roaming appdata directory. That means that for users on a Windows 25 network setup for roaming profiles, this user data will be 26 sync'd on login. See 27 <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx> 28 for a discussion of issues. 29 30 Typical user data directories are: 31 Mac OS X: ~/Library/Application Support/<AppName> 32 Unix: ~/.local/share/<AppName> # or in $XDG_DATA_HOME, if defined 33 Win XP (not roaming): C:\Documents and Settings\<username>\Application Data\<AppAuthor>\<AppName> 34 Win XP (roaming): C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName> 35 Win 7 (not roaming): C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName> 36 Win 7 (roaming): C:\Users\<username>\AppData\Roaming\<AppAuthor>\<AppName> 37 38 For Unix, we follow the XDG spec and support $XDG_DATA_HOME. 39 That means, by default "~/.local/share/<AppName>". 40 r N� CSIDL_APPDATA�CSIDL_LOCAL_APPDATAFr z~/Library/Application Support/� XDG_DATA_HOMEz~/.local/share��system�os�path�normpath�_get_win_folder�join� 41 expanduser�getenv)�appname� appauthor�version�roaming�constr � r ��C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\site-packages\pkg_resources\_vendor\appdirs.py� user_data_dir- s* ��r c s 42 t dkr)|du r 43 � }tj�td��}� r(|dur!tj�||� �}nWtj�|� �}nOt dkr=tj�d�}� r<tj�|� �}n;t�dtj�dd g��}d 44 d� |� tj�D �}� rh|r_tj�� |�� � fdd�|D �}|rrtj�|�}|S |d }|S � r�|r�tj�||�}|S )ai Return full path to the user-shared data dir for this application. 45 46 "appname" is the name of application. 47 If None, just the system directory is returned. 48 "appauthor" (only used on Windows) is the name of the 49 appauthor or distributing body for this application. Typically 50 it is the owning company name. This falls back to appname. You may 51 pass False to disable it. 52 "version" is an optional version path element to append to the 53 path. You might want to use this if you want multiple versions 54 of your app to be able to run independently. If used, this 55 would typically be "<major>.<minor>". 56 Only applied when appname is present. 57 "multipath" is an optional parameter only applicable to *nix 58 which indicates that the entire list of data dirs should be 59 returned. By default, the first item from XDG_DATA_DIRS is 60 returned, or '/usr/local/share/<AppName>', 61 if XDG_DATA_DIRS is not set 62 63 Typical site data directories are: 64 Mac OS X: /Library/Application Support/<AppName> 65 Unix: /usr/local/share/<AppName> or /usr/share/<AppName> 66 Win XP: C:\Documents and Settings\All Users\Application Data\<AppAuthor>\<AppName> 67 Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) 68 Win 7: C:\ProgramData\<AppAuthor>\<AppName> # Hidden, but writeable on Win 7. 69 70 For Unix, this is using the $XDG_DATA_DIRS[0] default. 71 72 WARNING: Do not use this on Windows. See the Vista-Fail note above for why. 73 r N�CSIDL_COMMON_APPDATAFr z/Library/Application Support� XDG_DATA_DIRSz/usr/local/sharez 74 /usr/sharec S � g | ]}t j�|�t j���qS r �r r r �rstrip�sep��.0�xr r r � 75 <listcomp>� � z!site_data_dir.<locals>.<listcomp>c � g | ] 76 }t j�|� g��qS r �r r$ r r% �r r r r( � � r ) 77 r r r r r r r r �pathsep�split�r r r � multipathr �pathlistr r, r � site_data_dird s<