-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
33 lines (24 loc) · 849 Bytes
/
utils.py
File metadata and controls
33 lines (24 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Copyright 2025 Said Emirhan Döke
# Licensed under the Apache License, Version 2.0
import json
import os
import sys
class Utils:
settings_file = "user_settings.txt"
def __init__(self):
pass
@classmethod
def load_user_settings(cls, setting_name):
path = Utils.resource_path(Utils.settings_file)
# Ayarları dosyadan yükle
if os.path.exists(path):
with open(path, "r") as file:
settings = json.load(file)
return settings[setting_name]
@classmethod
def resource_path(cls, relative_path):
try:
base_path = sys._MEIPASS # pyinstaller'ın geçici klasörü
except Exception:
base_path = os.path.abspath(".") # normal çalışma
return os.path.join(base_path, relative_path)