extract dirs in current directory works on appimage

This commit is contained in:
2025-06-20 23:41:32 +02:00
parent 3ba041a28e
commit a63d54f128
3 changed files with 44 additions and 0 deletions

View File

View File

@ -16,6 +16,7 @@ from manager import (
Image,
AppManager,
LxTools,
EnsureFiles,
)
from network import NetworkChecker
from message import MessageDialog
@ -1335,6 +1336,7 @@ def main():
try:
# Create and run the GUI
EnsureFiles.extract_data_files()
app = LXToolsGUI()
app.run()
except KeyboardInterrupt:

View File

@ -3,6 +3,8 @@ import gettext
import tkinter as tk
from tkinter import ttk
import os
import sys
import shutil
import subprocess
import stat
from network import GiteaUpdate
@ -286,6 +288,46 @@ class OSDetector:
return False
class EnsureFiles:
"""ckeck start as appimage andd extract data files"""
@staticmethod
def extract_data_files():
if getattr(sys, "_MEIPASS", None) is not None:
# Liste der Quellordner (entspricht dem "datas"-Eintrag in lxtools_installer.spec)
source_dirs = [
os.path.join(sys._MEIPASS, "locale"), # für locale/...
os.path.join(sys._MEIPASS, "TK-Themes"), # für TK-Themes/...
os.path.join(sys._MEIPASS, "lx-icons"), # für lx-icons/...
]
target_dir = os.path.abspath(
os.getcwd()
) # Zielverzeichnis: aktueller Ordner
for source_dir in source_dirs:
group_name = os.path.basename(
source_dir
) # Erhält den Gruppen-Name (z.B. 'locale', 'TK-Themes')
for root, dirs, files in os.walk(source_dir):
for file in files:
src_path = os.path.join(root, file)
# Relativer Pfad innerhalb des Quellordners
rel_path_from_source_root = os.path.relpath(
src_path, source_dir
)
# Ziel-Pfad unter dem Gruppen-Ordner im aktuellen Verzeichnis
dst_path = os.path.join(
target_dir, group_name, rel_path_from_source_root
)
os.makedirs(os.path.dirname(dst_path), exist_ok=True)
shutil.copy2(src_path, dst_path)
class Theme:
@staticmethod
def apply_light_theme(root):