Fix UNIX file open
In #10973 I refactored FileAccessUnix::_open() but I accidentally made it impossible to create new files. This fixes that and fixes #10984
This commit is contained in:
parent
a7c2ff5c94
commit
5fed954a1b
@ -91,15 +91,14 @@ Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) {
|
|||||||
//printf("opening %s as %s\n", p_path.utf8().get_data(), path.utf8().get_data());
|
//printf("opening %s as %s\n", p_path.utf8().get_data(), path.utf8().get_data());
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int err = stat(path.utf8().get_data(), &st);
|
int err = stat(path.utf8().get_data(), &st);
|
||||||
if (err)
|
if (!err) {
|
||||||
return ERR_FILE_CANT_OPEN;
|
switch (st.st_mode & S_IFMT) {
|
||||||
|
case S_IFLNK:
|
||||||
switch (st.st_mode & S_IFMT) {
|
case S_IFREG:
|
||||||
case S_IFLNK:
|
break;
|
||||||
case S_IFREG:
|
default:
|
||||||
break;
|
return ERR_FILE_CANT_OPEN;
|
||||||
default:
|
}
|
||||||
return ERR_FILE_CANT_OPEN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_backup_save_enabled() && (p_mode_flags & WRITE) && !(p_mode_flags & READ)) {
|
if (is_backup_save_enabled() && (p_mode_flags & WRITE) && !(p_mode_flags & READ)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user