From 71ce96e5a452e877dd986557c5a1ea55cc231450 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sat, 1 Jun 2019 17:47:14 -0700 Subject: [PATCH] Removing OS level directory cd implementations --- 4ed_system.h | 7 ---- platform_all/4ed_link_system_functions.cpp | 2 -- platform_all/4ed_shared_file_handling.cpp | 37 +--------------------- platform_linux/linux_4ed.cpp | 2 -- platform_mac/mac_4ed.cpp | 2 -- platform_win32/win32_4ed.cpp | 1 - 6 files changed, 1 insertion(+), 50 deletions(-) diff --git a/4ed_system.h b/4ed_system.h index 9984657c..4a850f8c 100644 --- a/4ed_system.h +++ b/4ed_system.h @@ -208,11 +208,6 @@ typedef Sys_Memory_Set_Protection_Sig(System_Memory_Set_Protection); typedef Sys_Memory_Free_Sig(System_Memory_Free); // file system - -// TODO(allen): eliminate -#define Sys_Directory_CD_Sig(name) b32 name(char *dir, i32 *len, i32 cap, char *rel_path, i32 rel_len) -typedef Sys_Directory_CD_Sig(System_Directory_CD); - #define Sys_Get_Current_Path_Sig(name) i32 name(char *out, i32 capacity) typedef Sys_Get_Current_Path_Sig(System_Get_Current_Path); @@ -286,8 +281,6 @@ struct System_Functions{ System_Memory_Set_Protection *memory_set_protection; System_Memory_Free *memory_free; - // TODO(allen): eliminate - System_Directory_CD *directory_cd; System_Get_Current_Path *get_current_path; System_Get_4ed_Path *get_4ed_path; diff --git a/platform_all/4ed_link_system_functions.cpp b/platform_all/4ed_link_system_functions.cpp index 0782fca3..471a283f 100644 --- a/platform_all/4ed_link_system_functions.cpp +++ b/platform_all/4ed_link_system_functions.cpp @@ -57,8 +57,6 @@ link_system_code(){ SYSLINK(memory_set_protection); SYSLINK(memory_free); - // TODO(allen): eliminate - SYSLINK(directory_cd); SYSLINK(get_current_path); SYSLINK(get_4ed_path); diff --git a/platform_all/4ed_shared_file_handling.cpp b/platform_all/4ed_shared_file_handling.cpp index 25994f89..715d8df9 100644 --- a/platform_all/4ed_shared_file_handling.cpp +++ b/platform_all/4ed_shared_file_handling.cpp @@ -9,42 +9,7 @@ // TOP -// TODO(allen): eliminate -internal -Sys_Directory_CD_Sig(system_directory_cd){ - String directory = make_string_cap(dir, *len, cap); - b32 result = false; - - if (rel_path[0] != 0){ - if (rel_path[0] == '.' && rel_path[1] == 0){ - result = true; - } - else if (rel_path[0] == '.' && rel_path[1] == '.' && rel_path[2] == 0){ - result = remove_last_folder(&directory); - terminate_with_null(&directory); - } - else{ - if (directory.size + rel_len + 1 > directory.memory_size){ - i32 old_size = directory.size; - append_partial_sc(&directory, rel_path); - append_s_char(&directory, SLASH); - terminate_with_null(&directory); - - if (system_directory_exists(directory.str)){ - result = true; - } - else{ - directory.size = old_size; - } - } - } - } - - *len = directory.size; - LOGF("%.*s: %d\n", directory.size, directory.str, result); - - return(result); -} +#error Eliminate this file // BOTTOM diff --git a/platform_linux/linux_4ed.cpp b/platform_linux/linux_4ed.cpp index 7e9b7b03..c9027f63 100644 --- a/platform_linux/linux_4ed.cpp +++ b/platform_linux/linux_4ed.cpp @@ -249,8 +249,6 @@ Sys_Now_Time_Sig(system_now_time){ return(result); } -#include "4ed_shared_file_handling.cpp" - //////////////////////////////// internal void diff --git a/platform_mac/mac_4ed.cpp b/platform_mac/mac_4ed.cpp index b6de3ced..3c5f3a77 100644 --- a/platform_mac/mac_4ed.cpp +++ b/platform_mac/mac_4ed.cpp @@ -158,8 +158,6 @@ Sys_Now_Time_Sig(system_now_time){ return(result); } -#include "4ed_shared_file_handling.cpp" - //////////////////////////////// void diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index 2e96a2fe..35fe6408 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -314,7 +314,6 @@ handle_type_ptr(void *ptr){ //////////////////////////////// #include "win32_4ed_functions.cpp" -#include "4ed_shared_file_handling.cpp" ////////////////////////////////