You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_appdirs.py 788B

5 years ago
1234567891011121314151617181920212223242526272829303132
  1. # -*- test-case-name: twisted.python.test.test_appdirs -*-
  2. # Copyright (c) Twisted Matrix Laboratories.
  3. # See LICENSE for details.
  4. """
  5. Application data directory support.
  6. """
  7. from __future__ import division, absolute_import
  8. import appdirs
  9. import inspect
  10. from twisted.python.compat import currentframe
  11. def getDataDirectory(moduleName=None):
  12. """
  13. Get a data directory for the caller function, or C{moduleName} if given.
  14. @param moduleName: The module name if you don't wish to have the caller's
  15. module.
  16. @type moduleName: L{str}
  17. @returns: A directory for putting data in.
  18. @rtype: L{str}
  19. """
  20. if not moduleName:
  21. caller = currentframe(1)
  22. moduleName = inspect.getmodule(caller).__name__
  23. return appdirs.user_data_dir(moduleName)