-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforze_root.py
More file actions
45 lines (38 loc) · 1009 Bytes
/
Copy pathforze_root.py
File metadata and controls
45 lines (38 loc) · 1009 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
34
35
36
37
38
39
40
41
42
43
44
45
# ==========================================
# forze_root.py
# ForzeOS proje kökünü yöneten dosya
# ==========================================
import os
import sys
# Proje kök dizini (ForzeOS System.py hangi klasördeyse)
ROOT = os.path.dirname(os.path.abspath(__file__))
def R(*parts):
"""
Proje kökünden güvenli path oluşturur.
Örnek: R("assets", "icons", "terminal.png")
"""
return os.path.join(ROOT, *parts)
def add_import(rel_path):
"""
Modülleri Python import yoluna ekler.
Böylece modüller klasör değiştirsen bile bozulmaz.
"""
full = R(rel_path)
if os.path.exists(full) and full not in sys.path:
sys.path.insert(0, full)
return True
return False
# Bu klasörler otomatik olarak import yoluna eklenir
DEFAULT_FOLDERS = [
"modules",
"modules/core",
"modules/apps",
"modules/ui",
"external",
"libs"
]
for folder in DEFAULT_FOLDERS:
try:
add_import(folder)
except:
pass