Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/turtleart.py
diff options
context:
space:
mode:
authorLuke Faraone <luke@faraone.cc>2010-08-20 19:29:47 (GMT)
committer Luke Faraone <luke@faraone.cc>2010-08-20 19:29:47 (GMT)
commit8f172ca9977b70eb68472a17e40e3cc1db79b163 (patch)
tree0bc039d5f5a3afa519585d70cf301c432e757eb3 /turtleart.py
parent00a8e55670ba30c1d76234e9a4dbb864e010c9aa (diff)
Use XDG Base Directory data dirs.
Diffstat (limited to 'turtleart.py')
-rwxr-xr-xturtleart.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/turtleart.py b/turtleart.py
index fb384c1..7848320 100755
--- a/turtleart.py
+++ b/turtleart.py
@@ -37,6 +37,14 @@ except ImportError, e:
print "Import Error: %s. Project upload is disabled." % (e)
_UPLOAD_AVAILABLE = False
+try:
+ # Try to use XDG Base Directory standard for config files
+ import xdg.BaseDirectory
+ CONFIG_HOME = os.path.join(xdg.BaseDirectory.xdg_config_home, 'turtleart')
+except ImportError, e:
+ # Default to `.config` per the spec.
+ CONFIG_HOME = os.path.expanduser(os.path.join('~', '.config', 'turtleart'))
+
argv = sys.argv[:] # Workaround for import behavior of gst in tagplay
sys.argv[1:] = [] # Execution of import gst cannot see '--help' or '-h'
@@ -143,9 +151,9 @@ class TurtleMain():
win = gtk.Window(gtk.WINDOW_TOPLEVEL)
try:
- data_file = open('.turtleartrc', 'r')
+ data_file = open(os.path.join(CONFIG_HOME, 'turtleartrc'), 'r')
except IOError:
- data_file = open('.turtleartrc', 'a+')
+ data_file = open(os.path.join(CONFIG_HOME, 'turtleartrc'), 'a+')
data_file.write(str(50) + '\n')
data_file.write(str(50) + '\n')
data_file.write(str(800) + '\n')