diff options
author | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-07-12 00:06:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 00:06:59 +0200 |
commit | a8fd3f828ab8ce67cf7df736af28fb6c61f0f1fa (patch) | |
tree | 818b14e6e04d75a7f288eca6c66272a7fa0c4508 /src/skel/crossplatform.cpp | |
parent | Unite all sliders (diff) | |
parent | finish COMPATIBLE_SAVES and FIX_INCOMPATIBLE_SAVES (diff) | |
download | re3-a8fd3f828ab8ce67cf7df736af28fb6c61f0f1fa.tar re3-a8fd3f828ab8ce67cf7df736af28fb6c61f0f1fa.tar.gz re3-a8fd3f828ab8ce67cf7df736af28fb6c61f0f1fa.tar.bz2 re3-a8fd3f828ab8ce67cf7df736af28fb6c61f0f1fa.tar.lz re3-a8fd3f828ab8ce67cf7df736af28fb6c61f0f1fa.tar.xz re3-a8fd3f828ab8ce67cf7df736af28fb6c61f0f1fa.tar.zst re3-a8fd3f828ab8ce67cf7df736af28fb6c61f0f1fa.zip |
Diffstat (limited to '')
-rw-r--r-- | src/skel/crossplatform.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/skel/crossplatform.cpp b/src/skel/crossplatform.cpp index 1d49ebd2..577983b6 100644 --- a/src/skel/crossplatform.cpp +++ b/src/skel/crossplatform.cpp @@ -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) |