Skip to content

Commit

Permalink
Move spices download cache to XDG_CACHE_HOME directory (linuxmint#1…
Browse files Browse the repository at this point in the history
…1176)

Users will need to redownload the cache, there are no other side effects.
  • Loading branch information
Gr3q authored Oct 17, 2022
1 parent 4229af9 commit 74c26ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions files/usr/bin/xlet-about-dialog
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import gettext
import datetime
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GdkPixbuf
from gi.repository import Gtk, GdkPixbuf, GLib

usage = """
usage : xlet-about-dialog applets/desklets/extensions uuid
Expand Down Expand Up @@ -81,15 +81,15 @@ class AboutDialog(Gtk.AboutDialog):

def get_spices_id(self):
try:
cache_path = os.path.join(home, '.cinnamon', 'spices.cache', self.stype[0:-1], 'index.json')
cache_path = os.path.join(GLib.get_user_cache_dir(), 'cinnamon', 'spices', self.stype[0:-1], 'index.json'),
if os.path.exists(cache_path):
with open(cache_path, 'r') as cache_file:
index_cache = json.load(cache_file)
if self.metadata['uuid'] in index_cache:
return index_cache[self.metadata['uuid']]['spices-id']
return None
except Exception as e:
print('Failed to load/parse index.json');
print('Failed to load/parse index.json')
print(e)
return None

Expand Down
2 changes: 1 addition & 1 deletion files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def __init__(self, collection_type, window=None):
self.total_jobs = 0
self.download_total_files = 0
self.download_current_file = 0
self.cache_folder = '%s/.cinnamon/spices.cache/%s/' % (home, self.collection_type)
self.cache_folder = os.path.join(GLib.get_user_cache_dir(), 'cinnamon', 'spices', self.collection_type)

if self.themes:
self.settings = Gio.Settings.new('org.cinnamon.theme')
Expand Down
4 changes: 2 additions & 2 deletions python3/cinnamon/harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
gi.require_version('Gio', '2.0')
from gi.repository import Gdk, Gtk, Gio
from gi.repository import Gdk, Gtk, Gio, GLib

from . import logger
from . import proxygsettings
Expand Down Expand Up @@ -125,7 +125,7 @@ def __init__(self, spice_type, uuid, index_node, meta_node):

class SpicePathSet():
def __init__(self, cache_item, spice_type):
cache_folder = Path('%s/.cinnamon/spices.cache/%s/' % (home, spice_type))
cache_folder = os.path.join(GLib.get_user_cache_dir(), 'cinnamon', 'spices', spice_type)

is_theme = spice_type == "theme"

Expand Down

0 comments on commit 74c26ab

Please sign in to comment.