appdirs.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Copyright (c) 2005-2010 ActiveState Software Inc.
  4. # Copyright (c) 2013 Eddy Petrișor
  5. # This is the MIT license
  6. #
  7. # Copyright (c) 2010 ActiveState Software Inc.
  8. #
  9. # Permission is hereby granted, free of charge, to any person obtaining a
  10. # copy of this software and associated documentation files (the
  11. # "Software"), to deal in the Software without restriction, including
  12. # without limitation the rights to use, copy, modify, merge, publish,
  13. # distribute, sublicense, and/or sell copies of the Software, and to
  14. # permit persons to whom the Software is furnished to do so, subject to
  15. # the following conditions:
  16. #
  17. # The above copyright notice and this permission notice shall be included
  18. # in all copies or substantial portions of the Software.
  19. #
  20. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21. # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  23. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  24. # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  25. # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  26. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. """Utilities for determining application-specific dirs.
  28. See <http://github.com/ActiveState/appdirs> for details and usage.
  29. """
  30. # Dev Notes:
  31. # - MSDN on where to store app data files:
  32. # http://support.microsoft.com/default.aspx?scid=kb;en-us;310294#XSLTH3194121123120121120120
  33. # - Mac OS X: http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/index.html
  34. # - XDG spec for Un*x: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
  35. __version_info__ = (1, 4, 0)
  36. __version__ = '.'.join(map(str, __version_info__))
  37. import sys
  38. import os
  39. PY3 = sys.version_info[0] == 3
  40. if PY3:
  41. unicode = str
  42. if sys.platform.startswith('java'):
  43. import platform
  44. os_name = platform.java_ver()[3][0]
  45. if os_name.startswith('Windows'): # "Windows XP", "Windows 7", etc.
  46. system = 'win32'
  47. elif os_name.startswith('Mac'): # "Mac OS X", etc.
  48. system = 'darwin'
  49. else: # "Linux", "SunOS", "FreeBSD", etc.
  50. # Setting this to "linux2" is not ideal, but only Windows or Mac
  51. # are actually checked for and the rest of the module expects
  52. # *sys.platform* style strings.
  53. system = 'linux2'
  54. else:
  55. system = sys.platform
  56. def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
  57. r"""Return full path to the user-specific data dir for this application.
  58. "appname" is the name of application.
  59. If None, just the system directory is returned.
  60. "appauthor" (only used on Windows) is the name of the
  61. appauthor or distributing body for this application. Typically
  62. it is the owning company name. This falls back to appname. You may
  63. pass False to disable it.
  64. "version" is an optional version path element to append to the
  65. path. You might want to use this if you want multiple versions
  66. of your app to be able to run independently. If used, this
  67. would typically be "<major>.<minor>".
  68. Only applied when appname is present.
  69. "roaming" (boolean, default False) can be set True to use the Windows
  70. roaming appdata directory. That means that for users on a Windows
  71. network setup for roaming profiles, this user data will be
  72. sync'd on login. See
  73. <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
  74. for a discussion of issues.
  75. Typical user data directories are:
  76. Mac OS X: ~/Library/Application Support/<AppName>
  77. Unix: ~/.local/share/<AppName> # or in $XDG_DATA_HOME, if defined
  78. Win XP (not roaming): C:\Documents and Settings\<username>\Application Data\<AppAuthor>\<AppName>
  79. Win XP (roaming): C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>
  80. Win 7 (not roaming): C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>
  81. Win 7 (roaming): C:\Users\<username>\AppData\Roaming\<AppAuthor>\<AppName>
  82. For Unix, we follow the XDG spec and support $XDG_DATA_HOME.
  83. That means, by default "~/.local/share/<AppName>".
  84. """
  85. if system == "win32":
  86. if appauthor is None:
  87. appauthor = appname
  88. const = roaming and "CSIDL_APPDATA" or "CSIDL_LOCAL_APPDATA"
  89. path = os.path.normpath(_get_win_folder(const))
  90. if appname:
  91. if appauthor is not False:
  92. path = os.path.join(path, appauthor, appname)
  93. else:
  94. path = os.path.join(path, appname)
  95. elif system == 'darwin':
  96. path = os.path.expanduser('~/Library/Application Support/')
  97. if appname:
  98. path = os.path.join(path, appname)
  99. else:
  100. path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share"))
  101. if appname:
  102. path = os.path.join(path, appname)
  103. if appname and version:
  104. path = os.path.join(path, version)
  105. return path
  106. def site_data_dir(appname=None, appauthor=None, version=None, multipath=False):
  107. """Return full path to the user-shared data dir for this application.
  108. "appname" is the name of application.
  109. If None, just the system directory is returned.
  110. "appauthor" (only used on Windows) is the name of the
  111. appauthor or distributing body for this application. Typically
  112. it is the owning company name. This falls back to appname. You may
  113. pass False to disable it.
  114. "version" is an optional version path element to append to the
  115. path. You might want to use this if you want multiple versions
  116. of your app to be able to run independently. If used, this
  117. would typically be "<major>.<minor>".
  118. Only applied when appname is present.
  119. "multipath" is an optional parameter only applicable to *nix
  120. which indicates that the entire list of data dirs should be
  121. returned. By default, the first item from XDG_DATA_DIRS is
  122. returned, or '/usr/local/share/<AppName>',
  123. if XDG_DATA_DIRS is not set
  124. Typical user data directories are:
  125. Mac OS X: /Library/Application Support/<AppName>
  126. Unix: /usr/local/share/<AppName> or /usr/share/<AppName>
  127. Win XP: C:\Documents and Settings\All Users\Application Data\<AppAuthor>\<AppName>
  128. Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.)
  129. Win 7: C:\ProgramData\<AppAuthor>\<AppName> # Hidden, but writeable on Win 7.
  130. For Unix, this is using the $XDG_DATA_DIRS[0] default.
  131. WARNING: Do not use this on Windows. See the Vista-Fail note above for why.
  132. """
  133. if system == "win32":
  134. if appauthor is None:
  135. appauthor = appname
  136. path = os.path.normpath(_get_win_folder("CSIDL_COMMON_APPDATA"))
  137. if appname:
  138. if appauthor is not False:
  139. path = os.path.join(path, appauthor, appname)
  140. else:
  141. path = os.path.join(path, appname)
  142. elif system == 'darwin':
  143. path = os.path.expanduser('/Library/Application Support')
  144. if appname:
  145. path = os.path.join(path, appname)
  146. else:
  147. # XDG default for $XDG_DATA_DIRS
  148. # only first, if multipath is False
  149. path = os.getenv('XDG_DATA_DIRS',
  150. os.pathsep.join(['/usr/local/share', '/usr/share']))
  151. pathlist = [os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep)]
  152. if appname:
  153. if version:
  154. appname = os.path.join(appname, version)
  155. pathlist = [os.sep.join([x, appname]) for x in pathlist]
  156. if multipath:
  157. path = os.pathsep.join(pathlist)
  158. else:
  159. path = pathlist[0]
  160. return path
  161. if appname and version:
  162. path = os.path.join(path, version)
  163. return path
  164. def user_config_dir(appname=None, appauthor=None, version=None, roaming=False):
  165. r"""Return full path to the user-specific config dir for this application.
  166. "appname" is the name of application.
  167. If None, just the system directory is returned.
  168. "appauthor" (only used on Windows) is the name of the
  169. appauthor or distributing body for this application. Typically
  170. it is the owning company name. This falls back to appname. You may
  171. pass False to disable it.
  172. "version" is an optional version path element to append to the
  173. path. You might want to use this if you want multiple versions
  174. of your app to be able to run independently. If used, this
  175. would typically be "<major>.<minor>".
  176. Only applied when appname is present.
  177. "roaming" (boolean, default False) can be set True to use the Windows
  178. roaming appdata directory. That means that for users on a Windows
  179. network setup for roaming profiles, this user data will be
  180. sync'd on login. See
  181. <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
  182. for a discussion of issues.
  183. Typical user data directories are:
  184. Mac OS X: same as user_data_dir
  185. Unix: ~/.config/<AppName> # or in $XDG_CONFIG_HOME, if defined
  186. Win *: same as user_data_dir
  187. For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME.
  188. That means, by deafult "~/.config/<AppName>".
  189. """
  190. if system in ["win32", "darwin"]:
  191. path = user_data_dir(appname, appauthor, None, roaming)
  192. else:
  193. path = os.getenv('XDG_CONFIG_HOME', os.path.expanduser("~/.config"))
  194. if appname:
  195. path = os.path.join(path, appname)
  196. if appname and version:
  197. path = os.path.join(path, version)
  198. return path
  199. def site_config_dir(appname=None, appauthor=None, version=None, multipath=False):
  200. """Return full path to the user-shared data dir for this application.
  201. "appname" is the name of application.
  202. If None, just the system directory is returned.
  203. "appauthor" (only used on Windows) is the name of the
  204. appauthor or distributing body for this application. Typically
  205. it is the owning company name. This falls back to appname. You may
  206. pass False to disable it.
  207. "version" is an optional version path element to append to the
  208. path. You might want to use this if you want multiple versions
  209. of your app to be able to run independently. If used, this
  210. would typically be "<major>.<minor>".
  211. Only applied when appname is present.
  212. "multipath" is an optional parameter only applicable to *nix
  213. which indicates that the entire list of config dirs should be
  214. returned. By default, the first item from XDG_CONFIG_DIRS is
  215. returned, or '/etc/xdg/<AppName>', if XDG_CONFIG_DIRS is not set
  216. Typical user data directories are:
  217. Mac OS X: same as site_data_dir
  218. Unix: /etc/xdg/<AppName> or $XDG_CONFIG_DIRS[i]/<AppName> for each value in
  219. $XDG_CONFIG_DIRS
  220. Win *: same as site_data_dir
  221. Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.)
  222. For Unix, this is using the $XDG_CONFIG_DIRS[0] default, if multipath=False
  223. WARNING: Do not use this on Windows. See the Vista-Fail note above for why.
  224. """
  225. if system in ["win32", "darwin"]:
  226. path = site_data_dir(appname, appauthor)
  227. if appname and version:
  228. path = os.path.join(path, version)
  229. else:
  230. # XDG default for $XDG_CONFIG_DIRS
  231. # only first, if multipath is False
  232. path = os.getenv('XDG_CONFIG_DIRS', '/etc/xdg')
  233. pathlist = [os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep)]
  234. if appname:
  235. if version:
  236. appname = os.path.join(appname, version)
  237. pathlist = [os.sep.join([x, appname]) for x in pathlist]
  238. if multipath:
  239. path = os.pathsep.join(pathlist)
  240. else:
  241. path = pathlist[0]
  242. return path
  243. def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True):
  244. r"""Return full path to the user-specific cache dir for this application.
  245. "appname" is the name of application.
  246. If None, just the system directory is returned.
  247. "appauthor" (only used on Windows) is the name of the
  248. appauthor or distributing body for this application. Typically
  249. it is the owning company name. This falls back to appname. You may
  250. pass False to disable it.
  251. "version" is an optional version path element to append to the
  252. path. You might want to use this if you want multiple versions
  253. of your app to be able to run independently. If used, this
  254. would typically be "<major>.<minor>".
  255. Only applied when appname is present.
  256. "opinion" (boolean) can be False to disable the appending of
  257. "Cache" to the base app data dir for Windows. See
  258. discussion below.
  259. Typical user cache directories are:
  260. Mac OS X: ~/Library/Caches/<AppName>
  261. Unix: ~/.cache/<AppName> (XDG default)
  262. Win XP: C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Cache
  263. Vista: C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\Cache
  264. On Windows the only suggestion in the MSDN docs is that local settings go in
  265. the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming
  266. app data dir (the default returned by `user_data_dir` above). Apps typically
  267. put cache data somewhere *under* the given dir here. Some examples:
  268. ...\Mozilla\Firefox\Profiles\<ProfileName>\Cache
  269. ...\Acme\SuperApp\Cache\1.0
  270. OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value.
  271. This can be disabled with the `opinion=False` option.
  272. """
  273. if system == "win32":
  274. if appauthor is None:
  275. appauthor = appname
  276. path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA"))
  277. if appname:
  278. if appauthor is not False:
  279. path = os.path.join(path, appauthor, appname)
  280. else:
  281. path = os.path.join(path, appname)
  282. if opinion:
  283. path = os.path.join(path, "Cache")
  284. elif system == 'darwin':
  285. path = os.path.expanduser('~/Library/Caches')
  286. if appname:
  287. path = os.path.join(path, appname)
  288. else:
  289. path = os.getenv('XDG_CACHE_HOME', os.path.expanduser('~/.cache'))
  290. if appname:
  291. path = os.path.join(path, appname)
  292. if appname and version:
  293. path = os.path.join(path, version)
  294. return path
  295. def user_log_dir(appname=None, appauthor=None, version=None, opinion=True):
  296. r"""Return full path to the user-specific log dir for this application.
  297. "appname" is the name of application.
  298. If None, just the system directory is returned.
  299. "appauthor" (only used on Windows) is the name of the
  300. appauthor or distributing body for this application. Typically
  301. it is the owning company name. This falls back to appname. You may
  302. pass False to disable it.
  303. "version" is an optional version path element to append to the
  304. path. You might want to use this if you want multiple versions
  305. of your app to be able to run independently. If used, this
  306. would typically be "<major>.<minor>".
  307. Only applied when appname is present.
  308. "opinion" (boolean) can be False to disable the appending of
  309. "Logs" to the base app data dir for Windows, and "log" to the
  310. base cache dir for Unix. See discussion below.
  311. Typical user cache directories are:
  312. Mac OS X: ~/Library/Logs/<AppName>
  313. Unix: ~/.cache/<AppName>/log # or under $XDG_CACHE_HOME if defined
  314. Win XP: C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Logs
  315. Vista: C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\Logs
  316. On Windows the only suggestion in the MSDN docs is that local settings
  317. go in the `CSIDL_LOCAL_APPDATA` directory. (Note: I'm interested in
  318. examples of what some windows apps use for a logs dir.)
  319. OPINION: This function appends "Logs" to the `CSIDL_LOCAL_APPDATA`
  320. value for Windows and appends "log" to the user cache dir for Unix.
  321. This can be disabled with the `opinion=False` option.
  322. """
  323. if system == "darwin":
  324. path = os.path.join(
  325. os.path.expanduser('~/Library/Logs'),
  326. appname)
  327. elif system == "win32":
  328. path = user_data_dir(appname, appauthor, version)
  329. version = False
  330. if opinion:
  331. path = os.path.join(path, "Logs")
  332. else:
  333. path = user_cache_dir(appname, appauthor, version)
  334. version = False
  335. if opinion:
  336. path = os.path.join(path, "log")
  337. if appname and version:
  338. path = os.path.join(path, version)
  339. return path
  340. class AppDirs(object):
  341. """Convenience wrapper for getting application dirs."""
  342. def __init__(self, appname, appauthor=None, version=None, roaming=False,
  343. multipath=False):
  344. self.appname = appname
  345. self.appauthor = appauthor
  346. self.version = version
  347. self.roaming = roaming
  348. self.multipath = multipath
  349. @property
  350. def user_data_dir(self):
  351. return user_data_dir(self.appname, self.appauthor,
  352. version=self.version, roaming=self.roaming)
  353. @property
  354. def site_data_dir(self):
  355. return site_data_dir(self.appname, self.appauthor,
  356. version=self.version, multipath=self.multipath)
  357. @property
  358. def user_config_dir(self):
  359. return user_config_dir(self.appname, self.appauthor,
  360. version=self.version, roaming=self.roaming)
  361. @property
  362. def site_config_dir(self):
  363. return site_config_dir(self.appname, self.appauthor,
  364. version=self.version, multipath=self.multipath)
  365. @property
  366. def user_cache_dir(self):
  367. return user_cache_dir(self.appname, self.appauthor,
  368. version=self.version)
  369. @property
  370. def user_log_dir(self):
  371. return user_log_dir(self.appname, self.appauthor,
  372. version=self.version)
  373. #---- internal support stuff
  374. def _get_win_folder_from_registry(csidl_name):
  375. """This is a fallback technique at best. I'm not sure if using the
  376. registry for this guarantees us the correct answer for all CSIDL_*
  377. names.
  378. """
  379. import _winreg
  380. shell_folder_name = {
  381. "CSIDL_APPDATA": "AppData",
  382. "CSIDL_COMMON_APPDATA": "Common AppData",
  383. "CSIDL_LOCAL_APPDATA": "Local AppData",
  384. }[csidl_name]
  385. key = _winreg.OpenKey(
  386. _winreg.HKEY_CURRENT_USER,
  387. r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
  388. )
  389. dir, type = _winreg.QueryValueEx(key, shell_folder_name)
  390. return dir
  391. def _get_win_folder_with_pywin32(csidl_name):
  392. from win32com.shell import shellcon, shell
  393. dir = shell.SHGetFolderPath(0, getattr(shellcon, csidl_name), 0, 0)
  394. # Try to make this a unicode path because SHGetFolderPath does
  395. # not return unicode strings when there is unicode data in the
  396. # path.
  397. try:
  398. dir = unicode(dir)
  399. # Downgrade to short path name if have highbit chars. See
  400. # <http://bugs.activestate.com/show_bug.cgi?id=85099>.
  401. has_high_char = False
  402. for c in dir:
  403. if ord(c) > 255:
  404. has_high_char = True
  405. break
  406. if has_high_char:
  407. try:
  408. import win32api
  409. dir = win32api.GetShortPathName(dir)
  410. except ImportError:
  411. pass
  412. except UnicodeError:
  413. pass
  414. return dir
  415. def _get_win_folder_with_ctypes(csidl_name):
  416. import ctypes
  417. csidl_const = {
  418. "CSIDL_APPDATA": 26,
  419. "CSIDL_COMMON_APPDATA": 35,
  420. "CSIDL_LOCAL_APPDATA": 28,
  421. }[csidl_name]
  422. buf = ctypes.create_unicode_buffer(1024)
  423. ctypes.windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf)
  424. # Downgrade to short path name if have highbit chars. See
  425. # <http://bugs.activestate.com/show_bug.cgi?id=85099>.
  426. has_high_char = False
  427. for c in buf:
  428. if ord(c) > 255:
  429. has_high_char = True
  430. break
  431. if has_high_char:
  432. buf2 = ctypes.create_unicode_buffer(1024)
  433. if ctypes.windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024):
  434. buf = buf2
  435. return buf.value
  436. def _get_win_folder_with_jna(csidl_name):
  437. import array
  438. from com.sun import jna
  439. from com.sun.jna.platform import win32
  440. buf_size = win32.WinDef.MAX_PATH * 2
  441. buf = array.zeros('c', buf_size)
  442. shell = win32.Shell32.INSTANCE
  443. shell.SHGetFolderPath(None, getattr(win32.ShlObj, csidl_name), None, win32.ShlObj.SHGFP_TYPE_CURRENT, buf)
  444. dir = jna.Native.toString(buf.tostring()).rstrip("\0")
  445. # Downgrade to short path name if have highbit chars. See
  446. # <http://bugs.activestate.com/show_bug.cgi?id=85099>.
  447. has_high_char = False
  448. for c in dir:
  449. if ord(c) > 255:
  450. has_high_char = True
  451. break
  452. if has_high_char:
  453. buf = array.zeros('c', buf_size)
  454. kernel = win32.Kernel32.INSTANCE
  455. if kernal.GetShortPathName(dir, buf, buf_size):
  456. dir = jna.Native.toString(buf.tostring()).rstrip("\0")
  457. return dir
  458. if system == "win32":
  459. try:
  460. import win32com.shell
  461. _get_win_folder = _get_win_folder_with_pywin32
  462. except ImportError:
  463. try:
  464. from ctypes import windll
  465. _get_win_folder = _get_win_folder_with_ctypes
  466. except ImportError:
  467. try:
  468. import com.sun.jna
  469. _get_win_folder = _get_win_folder_with_jna
  470. except ImportError:
  471. _get_win_folder = _get_win_folder_from_registry
  472. #---- self test code
  473. if __name__ == "__main__":
  474. appname = "MyApp"
  475. appauthor = "MyCompany"
  476. props = ("user_data_dir", "site_data_dir",
  477. "user_config_dir", "site_config_dir",
  478. "user_cache_dir", "user_log_dir")
  479. print("-- app dirs (with optional 'version')")
  480. dirs = AppDirs(appname, appauthor, version="1.0")
  481. for prop in props:
  482. print("%s: %s" % (prop, getattr(dirs, prop)))
  483. print("\n-- app dirs (without optional 'version')")
  484. dirs = AppDirs(appname, appauthor)
  485. for prop in props:
  486. print("%s: %s" % (prop, getattr(dirs, prop)))
  487. print("\n-- app dirs (without optional 'appauthor')")
  488. dirs = AppDirs(appname)
  489. for prop in props:
  490. print("%s: %s" % (prop, getattr(dirs, prop)))
  491. print("\n-- app dirs (with disabled 'appauthor')")
  492. dirs = AppDirs(appname, appauthor=False)
  493. for prop in props:
  494. print("%s: %s" % (prop, getattr(dirs, prop)))