Merge pull request #13 from alkino/master

Use os.path.join instead of hardcoded paths.
This commit is contained in:
thomasvs
2013-02-26 14:07:50 -08:00

View File

@@ -34,7 +34,7 @@ class Directory(log.Loggable):
path = os.path.join(directory, 'morituri.conf') path = os.path.join(directory, 'morituri.conf')
self.info('Using XDG, configuration file is %s' % path) self.info('Using XDG, configuration file is %s' % path)
except ImportError: except ImportError:
path = os.path.expanduser('~/.moriturirc') path = os.path.join(os.path.expanduser('~'), '.moriturirc')
self.info('Not using XDG, configuration file is %s' % path) self.info('Not using XDG, configuration file is %s' % path)
return path return path
@@ -45,7 +45,7 @@ class Directory(log.Loggable):
path = BaseDirectory.save_cache_path('morituri') path = BaseDirectory.save_cache_path('morituri')
self.info('Using XDG, cache directory is %s' % path) self.info('Using XDG, cache directory is %s' % path)
except ImportError: except ImportError:
path = os.path.expanduser('~/.morituri/cache') path = os.path.join(os.path.expanduser('~'), '.morituri', 'cache')
if not os.path.exists(path): if not os.path.exists(path):
os.makedirs(path) os.makedirs(path)
self.info('Not using XDG, cache directory is %s' % path) self.info('Not using XDG, cache directory is %s' % path)
@@ -68,7 +68,7 @@ class Directory(log.Loggable):
except ImportError: except ImportError:
pass pass
path = os.path.expanduser('~/.morituri/cache') path = os.path.join(os.path.expanduser('~'), '.morituri', 'cache')
if os.path.exists(path): if os.path.exists(path):
self.info('From before XDG, read cache directory is %s' % path) self.info('From before XDG, read cache directory is %s' % path)
paths.append(path) paths.append(path)