Making store and cache path done (more) right
authorEd Page <eopage@byu.net>
Sun, 16 May 2010 02:58:30 +0000 (21:58 -0500)
committerEd Page <eopage@byu.net>
Sun, 16 May 2010 04:05:00 +0000 (23:05 -0500)
src/MormonChannel.py
src/constants.py
src/mormonchannel_gtk.py

index 017c5f2..733e0b9 100755 (executable)
@@ -27,6 +27,12 @@ if __name__ == "__main__":
                if e.errno != 17:
                        raise
 
+       try:
+               os.makedirs(constants._cache_path_)
+       except OSError, e:
+               if e.errno != 17:
+                       raise
+
        logging.basicConfig(level=logging.DEBUG, filename=constants._user_logpath_)
        _moduleLogger.info("%s %s-%s" % (constants.__app_name__, constants.__version__, constants.__build__))
        _moduleLogger.info("OS: %s" % (os.uname()[0], ))
index ce529ab..e7239ca 100644 (file)
@@ -7,4 +7,5 @@ __build__ = 0
 __app_magic__ = 0xdeadbeef
 _data_path_ = os.path.join(os.path.expanduser("~"), ".%s" % __app_name__)
 _user_settings_ = "%s/settings.ini" % _data_path_
+_cache_path_ = "%s/cache" % _data_path_
 _user_logpath_ = "%s/%s.log" % (_data_path_, __app_name__)
index ccc49b8..40727ab 100755 (executable)
@@ -15,6 +15,7 @@
 
 from __future__ import with_statement
 
+import os
 import gc
 import logging
 import ConfigParser
@@ -47,7 +48,9 @@ class MormonChannelProgram(hildonize.get_app_class()):
 
        def __init__(self):
                super(MormonChannelProgram, self).__init__()
-               self._store = imagestore.ImageStore("../data", "../data")
+               currentPath = os.path.abspath(__file__)
+               storePath = os.path.join(os.path.split(os.path.dirname(currentPath))[0], "data")
+               self._store = imagestore.ImageStore(storePath, constants._cache_path_)
                self._index = stream_index.AudioIndex()
                self._player = player.Player(self._index)