Save data to user dir

This commit is contained in:
Ruud committed 2011-11-06 20:22:02 +01:00
1 parent 138845ca9e
commit 36ed61f549
8 files changed
+37 -15

No files matched your search

+18
View File
@@ -1,7 +1,25 @@
import hashlib
import os.path
import platform
import re
def getDataDir():
# Windows
try:
from win32com.shell import shellcon, shell
return os.path.join(shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0), 'CouchPotato')
except ImportError:
dir = os.path.expanduser("~")
# OSX
if 'darwin' in platform.platform().lower():
return os.path.join(dir, 'Library', 'Application Support', 'CouchPotato')
# Linux
return os.path.join(dir, '.couchpotato')
def isDict(object):
return isinstance(object, dict)