diff options
| author | dam <dam@gudinoff> | 2024-06-04 10:57:28 +0100 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2024-06-04 15:11:48 +0100 |
| commit | 45aef04664df07913c9ab75a0b329a2e370a5ecc (patch) | |
| tree | d0dc968e9d28dd6b2bbc91afadff5952c595eeed /ttt.jai | |
| parent | b809105861edc0c639863e2575e61f156c137ae1 (diff) | |
| download | task-time-tracker-45aef04664df07913c9ab75a0b329a2e370a5ecc.tar.zst task-time-tracker-45aef04664df07913c9ab75a0b329a2e370a5ecc.zip | |
Fix data path finding when no system folders are found.v2.2
Diffstat (limited to 'ttt.jai')
| -rw-r--r-- | ttt.jai | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -14,7 +14,7 @@ DEBUG :: false; #import "UTF8"; TUI :: #import "TUI"(COLOR_MODE_BITS=4); -VERSION :: "2.1"; // Use only 3 chars (to fit layouts). +VERSION :: "2.2"; // Use only 3 chars (to fit layouts). YEAR :: "2024"; NUM_WEEK_DAYS :: 7; @@ -1182,9 +1182,11 @@ main :: () { #if OS == { case .LINUX; + PATH_DELIMITER :: "/"; base_path = join(home_path, "/.local/share",, allocator = temporary_allocator); case .WINDOWS; + PATH_DELIMITER :: "\\"; base_path = join(home_path, "\\Appdata\\Roaming",, allocator = temporary_allocator); } @@ -1194,13 +1196,18 @@ main :: () { base_path = home_path; if how_much_of_path_exists_on_the_local_filesystem(parse_path(base_path,, allocator = temporary_allocator)) == false { // Default to current running executable path. - base_path = get_path_of_running_executable(); + base_path = path_strip_filename(get_path_of_running_executable()); } } - app_directory = join(base_path, "/", APP_FOLDER_NAME); - db_file_path = join(app_directory, "/", DB_FILE_NAME); - ar_file_path = join(app_directory, "/", AR_FILE_NAME); + if base_path[base_path.count-1] == PATH_DELIMITER[0] { + base_path.count -= 1; + } + + app_directory = join(base_path, PATH_DELIMITER, APP_FOLDER_NAME); + db_file_path = join(app_directory, PATH_DELIMITER, DB_FILE_NAME); + ar_file_path = join(app_directory, PATH_DELIMITER, AR_FILE_NAME); + make_directory_if_it_does_not_exist(app_directory, recursive = true); } |
