Skip to content

Commit 27d2147

Browse files
committed
Full Path Reading Fix
1 parent ce4b3ad commit 27d2147

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/utils/appdata.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@
99
APP_DIR: str = dirname(realpath(argv[0]))
1010

1111
def read(filepath: str) -> str | None:
12+
filepath = join(APP_DIR, filepath)
1213
if not exists(filepath):
1314
return None
1415

15-
full_path: str = join(APP_DIR, filepath)
16-
with open(full_path, 'r') as file:
16+
with open(filepath, 'r') as file:
1717
return file.read()
1818

1919
def write(filepath: str, content: str) -> bool:
20+
filepath = join(APP_DIR, filepath)
2021
folder_path: str = "/".join(filepath.split('/')[:-1])
22+
2123
if not exists(folder_path):
2224
makedirs(folder_path, exist_ok=True)
2325

24-
full_path: str = join(APP_DIR, filepath)
25-
with open(full_path, 'w') as file:
26+
with open(filepath, 'w') as file:
2627
file.write(content)
2728

2829
return True
@@ -31,7 +32,7 @@ def read_config(
3132
config: str,
3233
cached_return: bool = True
3334
) -> str | None:
34-
config_path: str = f"configs/{config}.txt"
35+
config_path: str = f"../configs/{config}.txt"
3536
if cached_return and config_path in cached_data:
3637
return cached_data[config_path]
3738

0 commit comments

Comments
 (0)