Sindbad~EG File Manager
3
�Pf`W�@s�dZd1Zdjeee��ZddlZddlZejddkZ e r>eZ
ejjd�r�ddlZej
�ddZejd�rrd Zq�ejd
�r�dZq�dZnejZd2dd�Zd3dd�Zd4dd�Zd5dd�Zd6dd�Zd7dd�ZGdd�de�Zdd�Zdd �Zd!d"�Zd#d$�Zed k�r�yddlZeZWnnek
�r�ydd%l m!Z!eZWnBek
�r|yddl"Z#eZWnek
�rveZYnXYnXYnXe$d&k�r~d'Z%d(Z&d8Z'e(d)�ee%e&d*d+�Z)x$e'D]Z*e(d,e*e+e)e*�f��q�We(d-�ee%e&�Z)x$e'D]Z*e(d,e*e+e)e*�f��q�We(d.�ee%�Z)x$e'D]Z*e(d,e*e+e)e*�f��q$We(d/�ee%d
d0�Z)x$e'D]Z*e(d,e*e+e)e*�f��q^WdS)9zyUtilities for determining application-specific dirs.
See <http://github.com/ActiveState/appdirs> for details and usage.
����.N��javaZWindows�win32ZMac�darwinZlinux2FcCs�tdkr^|dkr|}|rdpd}tjjt|��}|r�|dk rNtjj|||�}q�tjj||�}nNtdkr�tjjd�}|r�tjj||�}n&tjdtjjd ��}|r�tjj||�}|r�|r�tjj||�}|S)
aJReturn full path to the user-specific data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"appauthor" (only used on Windows) is the name of the
appauthor or distributing body for this application. Typically
it is the owning company name. This falls back to appname. You may
pass False to disable it.
"version" is an optional version path element to append to the
path. You might want to use this if you want multiple versions
of your app to be able to run independently. If used, this
would typically be "<major>.<minor>".
Only applied when appname is present.
"roaming" (boolean, default False) can be set True to use the Windows
roaming appdata directory. That means that for users on a Windows
network setup for roaming profiles, this user data will be
sync'd on login. See
<http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
for a discussion of issues.
Typical user data directories are:
macOS: ~/Library/Application Support/<AppName>
Unix: ~/.local/share/<AppName> # or in $XDG_DATA_HOME, if defined
Win XP (not roaming): C:\Documents and Settings\<username>\Application Data\<AppAuthor>\<AppName>
Win XP (roaming): C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>
Win 7 (not roaming): C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>
Win 7 (roaming): C:\Users\<username>\AppData\Roaming\<AppAuthor>\<AppName>
For Unix, we follow the XDG spec and support $XDG_DATA_HOME.
That means, by default "~/.local/share/<AppName>".
rN�
CSIDL_APPDATA�CSIDL_LOCAL_APPDATAFrz~/Library/Application Support/Z
XDG_DATA_HOMEz~/.local/share)�system�os�path�normpath�_get_win_folder�join�
expanduser�getenv)�appname� appauthor�version�roaming�constr
�r�/usr/lib/python3.6/appdirs.py�
user_data_dir-s& rcs
tdkrR|dkr�}tjjtd��}�r�|dk rBtjj||��}q�tjj|��}n�tdkrztjjd�}�r�tjj|��}nttjdtjjdd g��}d
d�|j tj�D�}�r�|r�tjj�|���fdd�|D�}|r�tjj|�}n|d
}|S�o�|�rtjj||�}|S)aiReturn full path to the user-shared data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"appauthor" (only used on Windows) is the name of the
appauthor or distributing body for this application. Typically
it is the owning company name. This falls back to appname. You may
pass False to disable it.
"version" is an optional version path element to append to the
path. You might want to use this if you want multiple versions
of your app to be able to run independently. If used, this
would typically be "<major>.<minor>".
Only applied when appname is present.
"multipath" is an optional parameter only applicable to *nix
which indicates that the entire list of data dirs should be
returned. By default, the first item from XDG_DATA_DIRS is
returned, or '/usr/local/share/<AppName>',
if XDG_DATA_DIRS is not set
Typical user data directories are:
macOS: /Library/Application Support/<AppName>
Unix: /usr/local/share/<AppName> or /usr/share/<AppName>
Win XP: C:\Documents and Settings\All Users\Application Data\<AppAuthor>\<AppName>
Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.)
Win 7: C:\ProgramData\<AppAuthor>\<AppName> # Hidden, but writeable on Win 7.
For Unix, this is using the $XDG_DATA_DIRS[0] default.
WARNING: Do not use this on Windows. See the Vista-Fail note above for why.
rN�CSIDL_COMMON_APPDATAFrz/Library/Application SupportZ
XDG_DATA_DIRSz/usr/local/sharez
/usr/sharecSs g|]}tjj|jtj���qSr)rr
r�rstrip�sep)�.0�xrrr�
<listcomp>�sz!site_data_dir.<locals>.<listcomp>csg|]}tjj|�g��qSr)rrr)rr)rrrr �sr)
rrr
rrrrr�pathsep�split)rrr� multipathr
�pathlistr)rr�
site_data_dirds4
r%cCsXtdkrt||d|�}n&tjdtjjd��}|r>tjj||�}|rT|rTtjj||�}|S)a�Return full path to the user-specific config dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"appauthor" (only used on Windows) is the name of the
appauthor or distributing body for this application. Typically
it is the owning company name. This falls back to appname. You may
pass False to disable it.
"version" is an optional version path element to append to the
path. You might want to use this if you want multiple versions
of your app to be able to run independently. If used, this
would typically be "<major>.<minor>".
Only applied when appname is present.
"roaming" (boolean, default False) can be set True to use the Windows
roaming appdata directory. That means that for users on a Windows
network setup for roaming profiles, this user data will be
sync'd on login. See
<http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
for a discussion of issues.
Typical user data directories are:
macOS: same as user_data_dir
Unix: ~/.config/<AppName> # or in $XDG_CONFIG_HOME, if defined
Win *: same as user_data_dir
For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME.
That means, by deafult "~/.config/<AppName>".
rrNZXDG_CONFIG_HOMEz ~/.config)rr)rrrrr
rr)rrrrr
rrr�user_config_dir�sr&cs�td kr*t�|�}�r�|r�tjj||�}ndtjdd�}dd�|jtj�D�}�rt|rbtjj�|���fdd�|D�}|r�tjj|�}n|d}|S)
aReturn full path to the user-shared data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"appauthor" (only used on Windows) is the name of the
appauthor or distributing body for this application. Typically
it is the owning company name. This falls back to appname. You may
pass False to disable it.
"version" is an optional version path element to append to the
path. You might want to use this if you want multiple versions
of your app to be able to run independently. If used, this
would typically be "<major>.<minor>".
Only applied when appname is present.
"multipath" is an optional parameter only applicable to *nix
which indicates that the entire list of config dirs should be
returned. By default, the first item from XDG_CONFIG_DIRS is
returned, or '/etc/xdg/<AppName>', if XDG_CONFIG_DIRS is not set
Typical user data directories are:
macOS: same as site_data_dir
Unix: /etc/xdg/<AppName> or $XDG_CONFIG_DIRS[i]/<AppName> for each value in
$XDG_CONFIG_DIRS
Win *: same as site_data_dir
Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.)
For Unix, this is using the $XDG_CONFIG_DIRS[0] default, if multipath=False
WARNING: Do not use this on Windows. See the Vista-Fail note above for why.
rrZXDG_CONFIG_DIRSz/etc/xdgcSs g|]}tjj|jtj���qSr)rr
rrr)rrrrrr �sz#site_config_dir.<locals>.<listcomp>csg|]}tjj|�g��qSr)rrr)rr)rrrr �sr)rr)rr%rr
rrr"r!)rrrr#r
r$r)rr�site_config_dir�s
r'TcCs�tdkrd|dkr|}tjjtd��}|r�|dk rBtjj|||�}ntjj||�}|r�tjj|d�}nNtdkr�tjjd�}|r�tjj||�}n&tjdtjjd ��}|r�tjj||�}|r�|r�tjj||�}|S)
aReturn full path to the user-specific cache dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"appauthor" (only used on Windows) is the name of the
appauthor or distributing body for this application. Typically
it is the owning company name. This falls back to appname. You may
pass False to disable it.
"version" is an optional version path element to append to the
path. You might want to use this if you want multiple versions
of your app to be able to run independently. If used, this
would typically be "<major>.<minor>".
Only applied when appname is present.
"opinion" (boolean) can be False to disable the appending of
"Cache" to the base app data dir for Windows. See
discussion below.
Typical user cache directories are:
macOS: ~/Library/Caches/<AppName>
Unix: ~/.cache/<AppName> (XDG default)
Win XP: C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Cache
Vista: C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\Cache
On Windows the only suggestion in the MSDN docs is that local settings go in
the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming
app data dir (the default returned by `user_data_dir` above). Apps typically
put cache data somewhere *under* the given dir here. Some examples:
...\Mozilla\Firefox\Profiles\<ProfileName>\Cache
...\Acme\SuperApp\Cache\1.0
OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value.
This can be disabled with the `opinion=False` option.
rNr
FZCacherz~/Library/CachesZXDG_CACHE_HOMEz~/.cache)rrr
rrrrr)rrr�opinionr
rrr�user_cache_dirs(!r)cCs�tdkr tjjtjjd�|�}nNtdkrLt|||�}d}|rntjj|d�}n"t|||�}d}|rntjj|d�}|r�|r�tjj||�}|S)a�Return full path to the user-specific log dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
"appauthor" (only used on Windows) is the name of the
appauthor or distributing body for this application. Typically
it is the owning company name. This falls back to appname. You may
pass False to disable it.
"version" is an optional version path element to append to the
path. You might want to use this if you want multiple versions
of your app to be able to run independently. If used, this
would typically be "<major>.<minor>".
Only applied when appname is present.
"opinion" (boolean) can be False to disable the appending of
"Logs" to the base app data dir for Windows, and "log" to the
base cache dir for Unix. See discussion below.
Typical user cache directories are:
macOS: ~/Library/Logs/<AppName>
Unix: ~/.cache/<AppName>/log # or under $XDG_CACHE_HOME if defined
Win XP: C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Logs
Vista: C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\Logs
On Windows the only suggestion in the MSDN docs is that local settings
go in the `CSIDL_LOCAL_APPDATA` directory. (Note: I'm interested in
examples of what some windows apps use for a logs dir.)
OPINION: This function appends "Logs" to the `CSIDL_LOCAL_APPDATA`
value for Windows and appends "log" to the user cache dir for Unix.
This can be disabled with the `opinion=False` option.
rz~/Library/LogsrFZLogs�log)rrr
rrrr))rrrr(r
rrr�user_log_dir:s
r+c@sbeZdZdZddd�Zedd��Zedd ��Zed
d��Zedd
��Z edd��Z
edd��ZdS)�AppDirsz1Convenience wrapper for getting application dirs.NFcCs"||_||_||_||_||_dS)N)rrrrr#)�selfrrrrr#rrr�__init__os
zAppDirs.__init__cCst|j|j|j|jd�S)N)rr)rrrrr)r-rrrrws
zAppDirs.user_data_dircCst|j|j|j|jd�S)N)rr#)r%rrrr#)r-rrrr%|s
zAppDirs.site_data_dircCst|j|j|j|jd�S)N)rr)r&rrrr)r-rrrr&�s
zAppDirs.user_config_dircCst|j|j|j|jd�S)N)rr#)r'rrrr#)r-rrrr'�s
zAppDirs.site_config_dircCst|j|j|jd�S)N)r)r)rrr)r-rrrr)�s
zAppDirs.user_cache_dircCst|j|j|jd�S)N)r)r+rrr)r-rrrr+�s
zAppDirs.user_log_dir)NNFF)�__name__�
__module__�__qualname__�__doc__r.�propertyrr%r&r'r)r+rrrrr,ms
r,cCs:ddl}dddd�|}|j|jd�}|j||�\}}|S)z�This is a fallback technique at best. I'm not sure if using the
registry for this guarantees us the correct answer for all CSIDL_*
names.
rNZAppDatazCommon AppDataz
Local AppData)r rr
z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)�_winreg�OpenKey�HKEY_CURRENT_USERZQueryValueEx)�
csidl_namer4Zshell_folder_name�key�dir�typerrr�_get_win_folder_from_registry�sr;cCs�ddlm}m}|jdt||�dd�}y`t|�}d}x|D]}t|�dkr:d}Pq:W|r�yddl}|j|�}Wnt k
r�YnXWnt
k
r�YnX|S)Nr)�shellcon�shellF�T)�win32com.shellr<r=�SHGetFolderPath�getattr�unicode�ord�win32api�GetShortPathName�ImportError�UnicodeError)r7r<r=r9�
has_high_char�crDrrr�_get_win_folder_with_pywin32�s$
rJcCs�ddl}dddd�|}|jd�}|jjjd|dd|�d}x|D]}t|�dkrBd }PqBW|r�|jd�}|jjj|j|d�r�|}|jS)
Nr��#�)r rr
iFr>T) �ctypesZcreate_unicode_buffer�windllZshell32ZSHGetFolderPathWrCZkernel32ZGetShortPathNameW�value)r7rNZcsidl_const�bufrHrIZbuf2rrr�_get_win_folder_with_ctypes�s"
rRcCs�ddl}ddlm}ddlm}|jjd}|jd|�}|jj }|j
dt|j|�d|jj
|�|jj|j��jd�}d}x|D]} t| �dkr~d }Pq~W|r�|jd|�}|jj }
tj|||�r�|jj|j��jd�}|S)
Nr)�jna)r�rI�Fr>T)�arrayZcom.sunrSZcom.sun.jna.platformrZWinDefZMAX_PATHZzerosZShell32ZINSTANCEr@rAZShlObjZSHGFP_TYPE_CURRENTZNativeZtoStringZtostringrrCZKernel32ZkernalrE)r7rVrSrZbuf_sizerQr=r9rHrIZkernelrrr�_get_win_folder_with_jna�s&
rW)rO�__main__ZMyAppZ MyCompanyz%-- app dirs (with optional 'version')z1.0)rz%s: %sz)
-- app dirs (without optional 'version')z+
-- app dirs (without optional 'appauthor')z(
-- app dirs (with disabled 'appauthor'))r)rrr)NNNF)NNNF)NNNF)NNNF)NNNT)NNNT)rr%r&r'r)r+),r2Z__version_info__r�map�str�__version__�sysr�version_infoZPY3rB�platform�
startswithZjava_verZos_namerrr%r&r'r)r+�objectr,r;rJrRrWr?Zwin32comrrFrNrOZcom.sun.jnaZcomr/rrZprops�print�dirsZproprArrrr�<module> s~
7
B
(
3
9
3+
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists