summaryrefslogtreecommitdiff
path: root/fs/appdirfs.py
diff options
context:
space:
mode:
authorwillmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f>2013-03-31 21:30:34 +0000
committerwillmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f>2013-03-31 21:30:34 +0000
commit838bfcd555fd6e4cd7eceaa7ccdbbdc78986cc06 (patch)
tree5547f10f29e28894ae70ff5b97e858456f94103a /fs/appdirfs.py
parent8c1e089ad130972b7867b393226b276f56c82ecb (diff)
downloadpyfilesystem-838bfcd555fd6e4cd7eceaa7ccdbbdc78986cc06.tar.gz
Change of api (fs.open, fs.setcontent, fs.getcontents) to support io module in Py2.6+ and Py3
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@854 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/appdirfs.py')
-rw-r--r--fs/appdirfs.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/appdirfs.py b/fs/appdirfs.py
index 913eac8..ff7dd69 100644
--- a/fs/appdirfs.py
+++ b/fs/appdirfs.py
@@ -6,8 +6,8 @@ A collection of filesystems that map to application specific locations.
These classes abstract away the different requirements for user data across platforms,
which vary in their conventions. They are all subclasses of :class:`fs.osfs.OSFS`,
-all that differs from `OSFS` is the constructor which detects the appropriate
-location given the name of the application, author name and other parameters.
+all that differs from `OSFS` is the constructor which detects the appropriate
+location given the name of the application, author name and other parameters.
Uses `appdirs` (https://github.com/ActiveState/appdirs), written by Trent Mick and Sridhar Ratnakumar <trentm at gmail com; github at srid name>
@@ -30,10 +30,10 @@ class UserDataFS(OSFS):
:param version: optional version string, if a unique location per version of the application is required
:param roaming: if True, use a *roaming* profile on Windows, see http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx
:param create: if True (the default) the directory will be created if it does not exist
-
+
"""
app_dirs = AppDirs(appname, appauthor, version, roaming)
- super(self.__class__, self).__init__(app_dirs.user_data_dir, create=create)
+ super(UserDataFS, self).__init__(app_dirs.user_data_dir, create=create)
class SiteDataFS(OSFS):
@@ -45,10 +45,10 @@ class SiteDataFS(OSFS):
:param version: optional version string, if a unique location per version of the application is required
:param roaming: if True, use a *roaming* profile on Windows, see http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx
:param create: if True (the default) the directory will be created if it does not exist
-
+
"""
app_dirs = AppDirs(appname, appauthor, version, roaming)
- super(self.__class__, self).__init__(app_dirs.site_data_dir, create=create)
+ super(SiteDataFS, self).__init__(app_dirs.site_data_dir, create=create)
class UserCacheFS(OSFS):
@@ -60,10 +60,10 @@ class UserCacheFS(OSFS):
:param version: optional version string, if a unique location per version of the application is required
:param roaming: if True, use a *roaming* profile on Windows, see http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx
:param create: if True (the default) the directory will be created if it does not exist
-
+
"""
app_dirs = AppDirs(appname, appauthor, version, roaming)
- super(self.__class__, self).__init__(app_dirs.user_cache_dir, create=create)
+ super(UserCacheFS, self).__init__(app_dirs.user_cache_dir, create=create)
class UserLogFS(OSFS):
@@ -75,13 +75,14 @@ class UserLogFS(OSFS):
:param version: optional version string, if a unique location per version of the application is required
:param roaming: if True, use a *roaming* profile on Windows, see http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx
:param create: if True (the default) the directory will be created if it does not exist
-
+
"""
app_dirs = AppDirs(appname, appauthor, version, roaming)
- super(self.__class__, self).__init__(app_dirs.user_log_dir, create=create)
+ super(UserLogFS, self).__init__(app_dirs.user_log_dir, create=create)
+
if __name__ == "__main__":
- udfs = UserDataFS('sexytime', appauthor='pyfs')
+ udfs = UserDataFS('exampleapp', appauthor='pyfs')
print udfs
- udfs2 = UserDataFS('sexytime2', appauthor='pyfs', create=False)
+ udfs2 = UserDataFS('exampleapp2', appauthor='pyfs', create=False)
print udfs2