Fixed app icon error; created .pkg

This commit is contained in:
Thomas Wilczynski 2025-11-22 14:56:29 -08:00
commit 4fea9596f9
8 changed files with 127 additions and 6 deletions

View file

@ -1,2 +1,2 @@
__version__ = "1.0.1"
__version__ = "1.0.2"
__author__ = "Gull"

View file

@ -54,12 +54,17 @@ class App(tk.Tk):
super().__init__()
self.title(APP_NAME)
self.option_add('*tearOff', tk.FALSE)
self.iconbitmap(ut.parse_dir("#/icon.ico"))
self.fm = fm.Manager(True) # Main file manager object
self.log = list() # Running list of all logs
self.temp = {"column": "", "reverse": False} # Temporary data
self.current_mode = "all"
self.custom_rules_path = RULES_PATH
try:
self.iconbitmap(ut.get_icon_file())
except Exception as error:
log.warning("Failed to load icon!")
self.gui() # User interface
self.load_config() # File rules configuration
self.prep() # Ready state

View file

@ -52,6 +52,20 @@ def save_json_file(filepath, data, raw=False):
json.dump(data, f, sort_keys=True, indent=None if raw else 2)
except Exception as error:
raise error
def get_icon_file():
"""Attempts to return a valid icon file."""
if os.name == "nt":
path = ""
try:
path = sys._MEIPASS # For PyInstaller
except Exception:
path = os.path.dirname(os.path.abspath(__file__))
return pathlib.Path(path).parent.parent / "icon.ico"
else:
path = os.path.dirname(os.path.abspath(__file__))
return pathlib.Path(path).parent.parent / "icon.svg"
def parse_dir(path="", ignore_mkdir=False):
"""Converts and creates a directory (can be full file path)."""