Changeset 789 for trunk/zoo-project/zoo-kernel/server_internal.c
- Timestamp:
- Nov 4, 2016, 4:58:41 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/server_internal.c
r785 r789 35 35 #endif 36 36 #include <signal.h> 37 38 // #include <stdlib.h> 39 /* 40 * Compare two file path strings to see if they refer to the same file. 41 * 42 * @param path1 the first file path 43 * @param path2 the second file path 44 * 45 * @return 0 if the files are identical 46 */ 47 #define PATHBUFSIZE 4096 48 int zoo_path_compare(char* path1, char* path2) { 49 50 if (path1 == NULL || path2 == NULL) { 51 return -1; 52 } 53 54 char realpath1[PATHBUFSIZE]; 55 char realpath2[PATHBUFSIZE]; 56 57 #ifdef WIN32 58 int res1 = GetFullPathName(path1, PATHBUFSIZE, realpath1, NULL); 59 int res2 = GetFullPathName(path2, PATHBUFSIZE, realpath2, NULL); 60 61 if (res1 == 0 || res2 == 0) { 62 return -1; 63 } 64 else { 65 return strncasecmp(realpath1, realpath2, PATHBUFSIZE); 66 } 67 #else 68 char* ptr1 = realpath(path1, realpath1); 69 char* ptr2 = realpath(path2, realpath2); 70 71 if (ptr1 == NULL || ptr2 == NULL) { 72 return -1; 73 } 74 else { 75 return strncmp(realpath1, realpath2, PATHBUFSIZE); 76 } 77 #endif 78 } 37 79 38 80 /**
Note: See TracChangeset
for help on using the changeset viewer.