U l a}`@sdZdZdeeeZddlZddlZejddkZ e r>eZ ej drddl Z e ddZe drrdZqe d rd Zqd Znej Zd4d dZd5ddZd6ddZd7ddZd8ddZd9ddZd:ddZGdddeZddZd d!Zd"d#Zd$d%ZedkrzddlZeZWnne k rzdd&l!m"Z"eZWnBe k rzddl#Z$eZWne k reZYnXYnXYnXe%d'krd(Z&d)Z'd*Z(e)d+ee)d,ee&e'd-d.Z*e(D]Z+e)d/e+e,e*e+fqe)d0ee&e'Z*e(D]Z+e)d/e+e,e*e+fqe)d1ee&Z*e(D]Z+e)d/e+e,e*e+fq0e)d2ee&d d3Z*e(D]Z+e)d/e+e,e*e+fqfdS);zyUtilities for determining application-specific dirs. See for details and usage. ).NrjavaWindowswin32ZMacdarwinZlinux2FcCstdkr^|dkr|}|rdpd}tjt|}|r|dk rNtj|||}qtj||}nNtdkrtjd}|rtj||}n&tdtjd }|rtj||}|r|rtj||}|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 ".". 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 for a discussion of issues. Typical user data directories are: Mac OS X: ~/Library/Application Support/ Unix: ~/.local/share/ # or in $XDG_DATA_HOME, if defined Win XP (not roaming): C:\Documents and Settings\\Application Data\\ Win XP (roaming): C:\Documents and Settings\\Local Settings\Application Data\\ Win 7 (not roaming): C:\Users\\AppData\Local\\ Win 7 (roaming): C:\Users\\AppData\Roaming\\ For Unix, we follow the XDG spec and support $XDG_DATA_HOME. That means, by default "~/.local/share/". rN CSIDL_APPDATACSIDL_LOCAL_APPDATAFr z~/Library/Application Support/ XDG_DATA_HOMEz~/.local/sharesystemospathnormpath_get_win_folderjoin expandusergetenv)appname appauthorversionroamingconstrr^C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-wx4infiz\pkg_resources\_vendor\appdirs.py user_data_dir-s&   rcs tdkrR|dkr}tjtd}r|dk rBtj||}qtj|}ntdkrztjd}rtj|}nttdtjdd g}d d | tjD}r|rtj|fd d |D}|rtj|}n|d }|Sr|rtj||}|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 ".". 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/', if XDG_DATA_DIRS is not set Typical site data directories are: Mac OS X: /Library/Application Support/ Unix: /usr/local/share/ or /usr/share/ Win XP: C:\Documents and Settings\All Users\Application Data\\ Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) Win 7: C:\ProgramData\\ # 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. rNCSIDL_COMMON_APPDATAFr z/Library/Application Support XDG_DATA_DIRSz/usr/local/sharez /usr/sharecSs g|]}tj|tjqSrrrrrstripsep.0xrrr sz!site_data_dir..csg|]}tj|gqSrrr"rr#rrrr&sr) rrrrrrrrpathsepsplitrrr multipathrpathlistrr(r site_data_dirds6  r.cCsXtdkrt||d|}n&tdtjd}|r>tj||}|rT|rTtj||}|S)aReturn 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 ".". 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 for a discussion of issues. Typical user config directories are: Mac OS X: same as user_data_dir Unix: ~/.config/ # 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 default "~/.config/". rr NXDG_CONFIG_HOMEz ~/.configrrrrrrrrrrrrrrruser_config_dirsr3cstdkr*t|}r|rtj||}ndtdd}dd|tjD}rt|rbtj|fdd|D}|rtj|}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 ".". 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/', if XDG_CONFIG_DIRS is not set Typical site config directories are: Mac OS X: same as site_data_dir Unix: /etc/xdg/ or $XDG_CONFIG_DIRS[i]/ 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. r/XDG_CONFIG_DIRSz/etc/xdgcSs g|]}tj|tjqSrr r#rrrr&sz#site_config_dir..csg|]}tj|gqSrr'r#r(rrr&sr)rr.rrrrr*r)r+rr(rsite_config_dirs  r5TcCstdkrd|dkr|}tjtd}|r|dk rBtj|||}ntj||}|rtj|d}nNtdkrtjd}|rtj||}n&tdtjd }|rtj||}|r|rtj||}|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 ".". 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: Mac OS X: ~/Library/Caches/ Unix: ~/.cache/ (XDG default) Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Cache Vista: C:\Users\\AppData\Local\\\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\\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 FCacher z~/Library/CachesXDG_CACHE_HOMEz~/.cacher rrropinionrrrruser_cache_dirs(! r:cCsXtdkrt||d|}n&tdtjd}|r>tj||}|rT|rTtj||}|S)aReturn full path to the user-specific state 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 ".". 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 for a discussion of issues. Typical user state directories are: Mac OS X: same as user_data_dir Unix: ~/.local/state/ # or in $XDG_STATE_HOME, if defined Win *: same as user_data_dir For Unix, we follow this Debian proposal to extend the XDG spec and support $XDG_STATE_HOME. That means, by default "~/.local/state/". r/NXDG_STATE_HOMEz~/.local/stater1r2rrruser_state_dir:sr<cCstdkr tjtjd|}nNtdkrLt|||}d}|rntj|d}n"t|||}d}|rntj|d}|r|rtj||}|S)aReturn 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 ".". 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 log directories are: Mac OS X: ~/Library/Logs/ Unix: ~/.cache//log # or under $XDG_CACHE_HOME if defined Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Logs Vista: C:\Users\\AppData\Local\\\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. r z~/Library/LogsrFLogslog)rrrrrrr:r8rrr user_log_dirds"    r?c@sneZdZdZdddZeddZedd Zed d Zed d Z eddZ eddZ eddZ dS)AppDirsz1Convenience wrapper for getting application dirs.NFcCs"||_||_||_||_||_dS)N)rrrrr,)selfrrrrr,rrr__init__s zAppDirs.__init__cCst|j|j|j|jdSN)rr)rrrrrrArrrrs zAppDirs.user_data_dircCst|j|j|j|jdSN)rr,)r.rrrr,rDrrrr.s zAppDirs.site_data_dircCst|j|j|j|jdSrC)r3rrrrrDrrrr3s zAppDirs.user_config_dircCst|j|j|j|jdSrE)r5rrrr,rDrrrr5s zAppDirs.site_config_dircCst|j|j|jdSNr)r:rrrrDrrrr:s zAppDirs.user_cache_dircCst|j|j|jdSrF)r<rrrrDrrrr<s zAppDirs.user_state_dircCst|j|j|jdSrF)r?rrrrDrrrr?s zAppDirs.user_log_dir)NNNFF) __name__ __module__ __qualname____doc__rBpropertyrr.r3r5r:r<r?rrrrr@s&       r@cCsHtrddl}nddl}dddd|}||jd}|||\}}|S)zThis 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. rNAppDatazCommon AppDataz Local AppDatar rr z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)PY3winreg_winregOpenKeyHKEY_CURRENT_USER QueryValueEx) csidl_namerQshell_folder_namekeydirtyperrr_get_win_folder_from_registrys rZcCsddlm}m}|dt||dd}z^t|}d}|D]}t|dkr8d}qRq8|rzddl}||}Wnt k rYnXWnt k rYnX|S)Nr)shellconshellFT) win32com.shellr[r\SHGetFolderPathgetattrunicodeordwin32apiGetShortPathName ImportError UnicodeError)rUr[r\rX has_high_charcrcrrr_get_win_folder_with_pywin32s$  ricCsddl}dddd|}|d}|jjd|dd|d}|D]}t|dkr@d }qZq@|r|d}|jj|j|dr|}|jS) Nr#rNiFr]T) ctypescreate_unicode_bufferwindllshell32SHGetFolderPathWrbkernel32GetShortPathNameWvalue)rUrm csidl_constbufrgrhbuf2rrr_get_win_folder_with_ctypess&   rxc Csddl}ddlm}ddlm}|jjd}|d|}|jj }| dt |j |d|j j ||j|d}d}|D]} t| dkr|d }qq||r|d|}|jj } | |||r|j|d}|S) Nr)jna)rrhFr]T)arraycom.sunrycom.sun.jna.platformrWinDefMAX_PATHzerosShell32INSTANCEr_r`ShlObjSHGFP_TYPE_CURRENTNativetoStringtostringr!rbKernel32rd) rUr|ryrbuf_sizervr\rXrgrhkernelrrr_get_win_folder_with_jnas&      r)ro__main__ZMyAppZ MyCompany)rr3r:r<r?r.r5z-- app dirs %s --z%-- app dirs (with optional 'version')z1.0rGz%s: %sz) -- app dirs (without optional 'version')z+ -- app dirs (without optional 'appauthor')z( -- app dirs (with disabled 'appauthor'))r)NNNF)NNNF)NNNF)NNNF)NNNT)NNNF)NNNT)-rK__version_info__rmapstr __version__sysr version_inforOraplatform startswithjava_veros_namerrr.r3r5r:r<r?objectr@rZrirxrr^Zwin32comrrermroZ com.sun.jnacomrHrrpropsprintdirspropr`rrrrs~     7 B ( 3 9 * 30