Removing OS level directory cd implementations
This commit is contained in:
parent
0e7287fbf3
commit
71ce96e5a4
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -249,8 +249,6 @@ Sys_Now_Time_Sig(system_now_time){
|
|||
return(result);
|
||||
}
|
||||
|
||||
#include "4ed_shared_file_handling.cpp"
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
internal void
|
||||
|
|
|
@ -158,8 +158,6 @@ Sys_Now_Time_Sig(system_now_time){
|
|||
return(result);
|
||||
}
|
||||
|
||||
#include "4ed_shared_file_handling.cpp"
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
void
|
||||
|
|
|
@ -314,7 +314,6 @@ handle_type_ptr(void *ptr){
|
|||
////////////////////////////////
|
||||
|
||||
#include "win32_4ed_functions.cpp"
|
||||
#include "4ed_shared_file_handling.cpp"
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
|
|
Loading…
Reference in New Issue