aboutsummaryrefslogtreecommitdiff
path: root/ttt.jai
diff options
context:
space:
mode:
Diffstat (limited to 'ttt.jai')
-rw-r--r--ttt.jai17
1 files changed, 12 insertions, 5 deletions
diff --git a/ttt.jai b/ttt.jai
index d169ab1..ca78b4b 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -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);
}