mirror of
https://github.com/GTAmodding/re3.git
synced 2025-08-28 07:40:50 +00:00
finish COMPATIBLE_SAVES and FIX_INCOMPATIBLE_SAVES
This commit is contained in:
parent
71f28c8cf5
commit
011aafa043
25 changed files with 1161 additions and 159 deletions
|
@ -155,6 +155,29 @@ FILE* _fcaseopen(char const* filename, char const* mode)
|
|||
return result;
|
||||
}
|
||||
|
||||
int _caserename(const char *old_filename, const char *new_filename)
|
||||
{
|
||||
int result;
|
||||
char *real_old = casepath(old_filename);
|
||||
char *real_new = casepath(new_filename);
|
||||
|
||||
// hack so we don't even try to rename it to new_filename if it already exists
|
||||
if (!real_new) {
|
||||
free(real_old);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!real_old)
|
||||
result = rename(old_filename, real_new);
|
||||
else
|
||||
result = rename(real_old, real_new);
|
||||
|
||||
free(real_old);
|
||||
free(real_new);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Case-insensitivity on linux (from https://github.com/OneSadCookie/fcaseopen)
|
||||
// Returned string should freed manually (if exists)
|
||||
char* casepath(char const* path, bool checkPathFirst)
|
||||
|
|
|
@ -29,6 +29,7 @@ enum eWinVersion
|
|||
#endif
|
||||
extern DWORD _dwOperatingSystemVersion;
|
||||
#define fcaseopen fopen
|
||||
#define caserename rename
|
||||
#else
|
||||
char *strupr(char *str);
|
||||
char *strlwr(char *str);
|
||||
|
@ -51,6 +52,8 @@ extern long _dwOperatingSystemVersion;
|
|||
char *casepath(char const *path, bool checkPathFirst = true);
|
||||
FILE *_fcaseopen(char const *filename, char const *mode);
|
||||
#define fcaseopen _fcaseopen
|
||||
int _caserename(const char *old_filename, const char *new_filename);
|
||||
#define caserename _caserename
|
||||
#endif
|
||||
|
||||
#ifdef RW_GL3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue