Index: config.py ================================================================== --- config.py +++ config.py @@ -204,17 +204,29 @@ # http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html def xdg(self, path="/streamtuner2"): home = os.environ.get("HOME", self.tmp) config = os.environ.get("XDG_CONFIG_HOME", os.environ.get("APPDATA", home+"/.config")) + datadir = os.environ.get("XDG_DATA_HOME", os.environ.get("APPDATA", home+"/.cache")) # storage dir self.dir = config + path + self.datadir = datadir + path # not actually used, for now we have subdir symlinks from .config to .cache # create if necessary if (not os.path.exists(self.dir)): os.makedirs(self.dir) + if (not os.path.exists(self.datadir)): + os.makedirs(self.datadir) + + # move/symlink cache files/dirs into datadir + if not self.windows: + for source, target in [(self.dir+"/"+sub, self.datadir+"/"+sub) for sub in ["cache", "icons", "themes"]]: + if os.path.exists(source) and not os.path.exists(target): + os.rename(source, target) + if os.path.exists(target) and not os.path.exists(source): + os.symlink(target, source) # store some configuration list/dict into a file def save(self, name="settings", data=None, gz=0, nice=0): name = name + ".json"