diff options
author | Marcelo Fernandez <marcelofg55@gmail.com> | 2018-03-09 11:45:21 -0300 |
---|---|---|
committer | Marcelo Fernandez <marcelofg55@gmail.com> | 2018-03-13 12:07:37 -0300 |
commit | a4e64c545406be00c00fe93818994977ae378fb9 (patch) | |
tree | 3c348b2d9184db62e2e4e89b5c9269568e8cf7a8 /drivers/windows/file_access_windows.cpp | |
parent | b84236944215445be191047ab628e570ffd69e99 (diff) | |
download | redot-engine-a4e64c545406be00c00fe93818994977ae378fb9.tar.gz |
Added File.get_path and File.get_path_absolute functions
Diffstat (limited to 'drivers/windows/file_access_windows.cpp')
-rw-r--r-- | drivers/windows/file_access_windows.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index 072790876f..e10f4d05e8 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -57,7 +57,8 @@ void FileAccessWindows::check_errors() const { Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) { - String filename = fix_path(p_path); + path_src = p_path; + path = fix_path(p_path); if (f) close(); @@ -78,19 +79,19 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) { backend supports utf8 encoding */ struct _stat st; - if (_wstat(filename.c_str(), &st) == 0) { + if (_wstat(path.c_str(), &st) == 0) { if (!S_ISREG(st.st_mode)) return ERR_FILE_CANT_OPEN; }; if (is_backup_save_enabled() && p_mode_flags & WRITE && !(p_mode_flags & READ)) { - save_path = filename; - filename = filename + ".tmp"; + save_path = path; + path = path + ".tmp"; //print_line("saving instead to "+path); } - f = _wfopen(filename.c_str(), mode_string); + f = _wfopen(path.c_str(), mode_string); if (f == NULL) { last_error = ERR_FILE_CANT_OPEN; @@ -154,6 +155,17 @@ void FileAccessWindows::close() { ERR_FAIL_COND(rename_error); } } + +String FileAccessWindows::get_path() const { + + return path_src; +} + +String FileAccessWindows::get_path_absolute() const { + + return path; +} + bool FileAccessWindows::is_open() const { return (f != NULL); |