From 6bb49cc16cbf03d4e0980c2343372ff20d0a4b55 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sun, 17 Nov 2024 22:36:53 -0600 Subject: rename all scripts to have .user.js ext --- mkconfig.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'mkconfig.py') diff --git a/mkconfig.py b/mkconfig.py index 47cc0ee..ad04413 100644 --- a/mkconfig.py +++ b/mkconfig.py @@ -10,16 +10,13 @@ if os.path.isfile("settings.json"): settings = json.load(f) # get all userscripts -paths = glob.glob(os.path.join('.', '**', '*.js'), recursive=True) -paths = [ path.removesuffix(".js") for path in paths ] +paths = glob.glob(os.path.join('.', '**', '*.user.js'), recursive=True) # zipp with zipfile.ZipFile("violentmonkey.zip", 'w', zipfile.ZIP_DEFLATED) as zipf: for path in paths: - arcname = os.path.basename(path) + ".user.js" # basename and add .user.js suffix - path += ".js" - zipf.write(path, arcname=arcname) + zipf.write(path, arcname=os.path.basename(path)) zipf.writestr("violentmonkey", json.dumps({ - "scripts": { os.path.basename(path): {} for path in paths }, + "scripts": { os.path.basename(path).removesuffix(".user.js"): {} for path in paths }, "settings": settings, })) -- cgit v1.2.3