aboutsummaryrefslogtreecommitdiff
path: root/ttt.jai
diff options
context:
space:
mode:
authordam <dam@gudinoff>2023-02-16 18:08:43 +0000
committerdam <dam@gudinoff>2023-02-16 18:08:43 +0000
commit0b0559e3750c0cc0662640f293cfa7c1f8d0af17 (patch)
treed01605e355714cdb0d292cc4c2f73820fff03709 /ttt.jai
parent027f9648e00ba40c1e64da0827c93299106503dc (diff)
downloadtask-time-tracker-0b0559e3750c0cc0662640f293cfa7c1f8d0af17.tar.zst
task-time-tracker-0b0559e3750c0cc0662640f293cfa7c1f8d0af17.zip
Initialize app directory and file paths.
Diffstat (limited to 'ttt.jai')
-rw-r--r--ttt.jai61
1 files changed, 23 insertions, 38 deletions
diff --git a/ttt.jai b/ttt.jai
index 345e3cc..1eaf8e1 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -1207,56 +1207,31 @@ bool read_enter_confirmation(int row, int style, const char *message) {
}
*/
-
main :: () {
defer free_memory();
- { // Initialize app directory.
-
- home_dir, success := get_home_directory(); // Returns system owned memory.
- if success == false {
+ { // Initialize app directory.
+ home_dir, success_dir := get_home_directory(); // Returns system owned memory.
+ if success_dir == false {
home_dir = ".";
}
- app_directory, success = get_absolute_path(home_dir); // TODO Returns temporary memory.
- if success == false {
+ home_path, success_path := get_absolute_path(home_dir); // Returns temporary memory.
+ if success_path == false {
print_error("Failed to find home directory '%'.", home_dir);
return;
}
- app_directory = join(app_directory, "/", APP_FOLDER_NAME, allocator = temp); // TODO Change to default allocator because we want to keep this during runtime.
-// print(">%:%:%\n", temp, temp.data, context.temporary_storage.data);
- print("#%\n", <<type_info(type_of(temp)));
- print("--------------------------------------\n");
- print("#%\n", type_info(type_of(temp)).members.data.type);
- data_type := type_info(type_of(temp)).members.data.type;
- print("#%\n", <<data_type);
- print("#%\n", type_of(data_type));
- print("#%\n", type_info(type_of(temp)).members);
- print("--------------------------------------\n");
-// print("#%\n", <<type_info(type_of(<<context.temporary_storage)));
-// print(">%:%\n", app_directory.count, *app_directory.data);
-// free(app_directory);
-
- /* WIP TEST THIS
-some_pointer : *void = get_something();
-is_it_mine : bool = xx allocator.allocator_proc(.IS_THIS_YOURS, 0, 0, some_pointer, null);
- */
+ app_directory = join(home_path, "/", APP_FOLDER_NAME);
+ db_file_path = join(app_directory, "/", DB_FILE_NAME);
+ ar_file_path = join(app_directory, "/", AR_FILE_NAME);
-
- reset_temporary_storage();
- a := join("wow", "testsesesrserse", "2222222222222222");
- b := join("wow", "testsesesrserse", "2222222222222222");
- c := join("wow", "testsesesrserse", "2222222222222222");
- d := join("wow", "testsesesrserse", "2222222222222222");
- print("bazinga: '%'\n", app_directory);
-// if make_directory_if_it_does_not_exist(app_directory, false) == false {
-// print_error("Failed to create app directory '%'.", app_directory);
-// return;
-// }
- db_file_path = join(app_directory, "/", DB_FILE_NAME, allocator = temp); // TODO Change to default allocator because we want to keep this during runtime.
- ar_file_path = join(app_directory, "/", AR_FILE_NAME, allocator = temp); // TODO Change to default allocator because we want to keep this during runtime.
+ // TODO DEBUG
+ print_owner_allocator("home_path", home_path.data);
+ print_owner_allocator("app_directory", app_directory.data);
+ print_owner_allocator("db_file_path", db_file_path.data);
+ print_owner_allocator("ar_file_path", ar_file_path.data);
}
return; // TODO DEBUG
@@ -1858,3 +1833,13 @@ main :: () {
}
*/
+
+
+print_owner_allocator :: (tag: string, memory: *void) {
+ owner := "unkown";
+
+ if true == xx context.allocator.proc(.IS_THIS_YOURS, 0, 0, memory, null) then owner = "default";
+ else if true == xx temp.proc(.IS_THIS_YOURS, 0, 0, memory, null) then owner = "temp";
+
+ print("'%' belongs to '%'\n", tag, owner);
+}