summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-03-05 13:13:08 +0100
committerRémi Verschelde <remi@verschelde.fr>2016-03-05 13:13:08 +0100
commit21335e502cfb2ad2cfc62aafd1fa621823c9089d (patch)
tree25880b52be7f2eb71ca0dec365b758967630df9c /drivers
parent6b1ca582f94b23e000e8c930586bf980e12e622c (diff)
parentd7052ddba334de3df1190837c6d8589b48799965 (diff)
Merge pull request #3893 from leezh/diraccess_fix
Added relative paths for DirAccess::remove()
Diffstat (limited to 'drivers')
-rw-r--r--drivers/unix/dir_access_unix.cpp7
-rw-r--r--drivers/windows/dir_access_windows.cpp7
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 23a63be339..8b097ad25e 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -292,8 +292,11 @@ Error DirAccessUnix::rename(String p_path,String p_new_path) {
}
Error DirAccessUnix::remove(String p_path) {
- p_path=fix_path(p_path);
-
+ if (p_path.is_rel_path())
+ p_path=get_current_dir().plus_file(p_path);
+ else
+ p_path=fix_path(p_path);
+
struct stat flags;
if ((stat(p_path.utf8().get_data(),&flags)!=0))
return FAILED;
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index 0a413979fc..b9476b870b 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -310,8 +310,11 @@ Error DirAccessWindows::rename(String p_path,String p_new_path) {
Error DirAccessWindows::remove(String p_path) {
- p_path=fix_path(p_path);
-
+ if (p_path.is_rel_path())
+ p_path=get_current_dir().plus_file(p_path);
+ else
+ p_path=fix_path(p_path);
+
printf("erasing %s\n",p_path.utf8().get_data());
//WIN32_FILE_ATTRIBUTE_DATA fileInfo;
//DWORD fileAttr = GetFileAttributesExW(p_path.c_str(), GetFileExInfoStandard, &fileInfo);