From d676f5f0b83a2c0a5e9b0b177f3ee7a8bb15eca1 Mon Sep 17 00:00:00 2001 From: insofaras Date: Wed, 24 Feb 2016 16:52:18 +0000 Subject: [PATCH] Sys_File_Paths_Equal --- 4ed_system.h | 3 +++ linux_4ed.cpp | 16 ++++++++++++++++ win32_4ed.cpp | 11 +++++++++++ 3 files changed, 30 insertions(+) diff --git a/4ed_system.h b/4ed_system.h index 8f89545d..19cc0e3b 100644 --- a/4ed_system.h +++ b/4ed_system.h @@ -31,6 +31,9 @@ typedef Sys_File_Time_Stamp_Sig(System_File_Time_Stamp); #define Sys_Set_File_List_Sig(name) void name(File_List *file_list, String directory) typedef Sys_Set_File_List_Sig(System_Set_File_List); +#define Sys_File_Paths_Equal_Sig(name) b32 name(char *path_a, char *path_b) +typedef Sys_File_Paths_Equal_Sig(System_File_Paths_Equal); + #define Sys_Post_Clipboard_Sig(name) void name(String str) typedef Sys_Post_Clipboard_Sig(System_Post_Clipboard); diff --git a/linux_4ed.cpp b/linux_4ed.cpp index f2d33038..ded42bed 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -369,6 +369,22 @@ Sys_Set_File_List_Sig(system_set_file_list){ } } +Sys_File_Paths_Equal_Sig(system_file_paths_equal){ + b32 result = 0; + + char* real_a = realpath(path_a, NULL); + char* real_b = realpath(path_b, NULL); + + if(real_a && real_b){ + result = strcmp(real_a, real_b); + + free(real_a); + free(real_b); + } + + return result; +} + Sys_Post_Clipboard_Sig(system_post_clipboard){ LinuxStringDup(&linuxvars.clipboard_outgoing, str.str, str.size); XSetSelectionOwner(linuxvars.XDisplay, linuxvars.atom_CLIPBOARD, linuxvars.XWindow, CurrentTime); diff --git a/win32_4ed.cpp b/win32_4ed.cpp index 326189c3..3cd928c6 100644 --- a/win32_4ed.cpp +++ b/win32_4ed.cpp @@ -495,6 +495,17 @@ DIRECTORY_CD_SIG(system_directory_cd){ return(result); } +Sys_File_Paths_Equal_Sig(system_file_paths_equal){ + b32 result = 0; + + // TODO(someone who knows windows): implement me + + AllowLocal(path_a); + AllowLocal(path_b); + + return result; +} + internal Sys_Post_Clipboard_Sig(system_post_clipboard){ if (OpenClipboard(win32vars.window_handle)){