diff --git a/platform_linux/linux_4ed.cpp b/platform_linux/linux_4ed.cpp index 6bdbb42a..9a9ba270 100644 --- a/platform_linux/linux_4ed.cpp +++ b/platform_linux/linux_4ed.cpp @@ -42,9 +42,12 @@ #include "4ed_rendering.h" #include "4ed.h" +#include "4ed_file_track.h" +#include "4ed_font_interface_to_os.h" +#include "4ed_system_shared.h" + #include "unix_4ed_functions.cpp" -#include #include #include @@ -103,10 +106,6 @@ #define InterlockedCompareExchange(dest, ex, comp) __sync_val_compare_and_swap((dest), (comp), (ex)) -#include "4ed_file_track.h" -#include "4ed_font_interface_to_os.h" -#include "4ed_system_shared.h" - // // Linux structs / enums // @@ -247,6 +246,7 @@ internal Sys_Release_Lock_Sig(system_release_lock); internal void system_wait_cv(i32, i32); internal void system_signal_cv(i32, i32); +#if 0 // // Shared system functions (system_shared.h) // @@ -272,6 +272,7 @@ Sys_Get_Binary_Path_Sig(system_get_binary_path){ return size; } +#endif // // Files diff --git a/platform_mac/mac_4ed.cpp b/platform_mac/mac_4ed.cpp index 9efbe3bb..ef108657 100644 --- a/platform_mac/mac_4ed.cpp +++ b/platform_mac/mac_4ed.cpp @@ -1,7 +1,7 @@ /* * Mr. 4th Dimention - Allen Webster * - * 06.28.2017 + * 28.06.2017 * * Mac C++ layer for 4coder * @@ -39,6 +39,10 @@ #include "4ed_rendering.h" #include "4ed.h" +#include "4ed_file_track.h" +#include "4ed_font_interface_to_os.h" +#include "4ed_system_shared.h" + #include "unix_4ed_functions.cpp" #include "osx_objective_c_to_cpp_links.h" diff --git a/platform_mac/mac_4ed.m b/platform_mac/mac_4ed.m index 6077de47..912d040a 100644 --- a/platform_mac/mac_4ed.m +++ b/platform_mac/mac_4ed.m @@ -1,7 +1,7 @@ /* * Mr. 4th Dimention - Allen Webster * - * 06.28.2017 + * 28.06.2017 * * Mac Objective C layer for 4coder * diff --git a/platform_unix/unix_4ed_functions.cpp b/platform_unix/unix_4ed_functions.cpp index 9a4aa35b..c05c72c1 100644 --- a/platform_unix/unix_4ed_functions.cpp +++ b/platform_unix/unix_4ed_functions.cpp @@ -1,7 +1,7 @@ /* * Mr. 4th Dimention - Allen Webster * - * 06.30.2017 + * 30.06.2017 * * General unix functions * @@ -17,6 +17,10 @@ #include +#if defined(USE_LOG) +# include +#endif + struct Unix_Vars{ b32 do_logging; }; @@ -44,6 +48,32 @@ Sys_Log_Sig(system_log){ } } +// +// Shared system functions (system_shared.h) +// + +internal +Sys_File_Can_Be_Made_Sig(system_file_can_be_made){ + b32 result = access((char*)filename, W_OK) == 0; + LOGF("%s = %d", filename, result); + return(result); +} + +internal +Sys_Get_Binary_Path_Sig(system_get_binary_path){ + ssize_t size = readlink("/proc/self/exe", out->str, out->memory_size - 1); + if(size != -1 && size < out->memory_size - 1){ + out->size = size; + remove_last_folder(out); + terminate_with_null(out); + size = out->size; + } else { + size = 0; + } + + return size; +} + // // Memory //