From 1de1a04b78b65254aa41d7930947df82a121160c Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 18 Apr 2015 20:11:33 -0300 Subject: -fix local and global usage for DirAccess, fixes #791 please test anyway.. --- drivers/unix/dir_access_unix.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'drivers/unix') diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index a1617eb0b4..0c0867e030 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -87,7 +87,7 @@ bool DirAccessUnix::dir_exists(String p_dir) { if (p_dir.is_rel_path()) - p_dir=current_dir+"/"+p_dir; + p_dir=get_current_dir().plus_file(p_dir); else p_dir=fix_path(p_dir); @@ -278,9 +278,16 @@ String DirAccessUnix::get_current_dir() { Error DirAccessUnix::rename(String p_path,String p_new_path) { - p_path=fix_path(p_path); - p_new_path=fix_path(p_new_path); - + if (p_path.is_rel_path()) + p_path=get_current_dir().plus_file(p_path); + else + p_path=fix_path(p_path); + + if (p_new_path.is_rel_path()) + p_new_path=get_current_dir().plus_file(p_new_path); + else + p_new_path=fix_path(p_new_path); + return ::rename(p_path.utf8().get_data(),p_new_path.utf8().get_data())==0?OK:FAILED; } Error DirAccessUnix::remove(String p_path) { -- cgit v1.2.3