Merge pull request #3893 from leezh/diraccess_fix

Added relative paths for DirAccess::remove()
This commit is contained in:
Rémi Verschelde 2016-03-05 13:13:08 +01:00
commit 21335e502c
4 changed files with 17 additions and 8 deletions

View file

@ -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;

View file

@ -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);

View file

@ -183,12 +183,12 @@ size_t DirAccessFlash::get_space_left() {
Error DirAccessFlash::rename(String p_from, String p_to) {
return FAILED;
ERR_FAIL_V(ERR_UNAVAILABLE);
};
Error DirAccessFlash::remove(String p_name) {
return FAILED;
ERR_FAIL_V(ERR_UNAVAILABLE);
};
extern char* psp_drive;

View file

@ -297,8 +297,11 @@ Error DirAccessOSX::rename(String p_path,String p_new_path) {
}
Error DirAccessOSX::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;