[Web] Fix DirAccess::unlink() not updating the IDBFS
This commit is contained in:
@ -438,11 +438,19 @@ Error DirAccessUnix::remove(String p_path) {
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
int err;
|
||||
if (S_ISDIR(flags.st_mode) && !is_link(p_path)) {
|
||||
return ::rmdir(p_path.utf8().get_data()) == 0 ? OK : FAILED;
|
||||
err = ::rmdir(p_path.utf8().get_data());
|
||||
} else {
|
||||
return ::unlink(p_path.utf8().get_data()) == 0 ? OK : FAILED;
|
||||
err = ::unlink(p_path.utf8().get_data());
|
||||
}
|
||||
if (err != 0) {
|
||||
return FAILED;
|
||||
}
|
||||
if (remove_notification_func != nullptr) {
|
||||
remove_notification_func(p_path);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool DirAccessUnix::is_link(String p_file) {
|
||||
@ -552,6 +560,8 @@ DirAccessUnix::DirAccessUnix() {
|
||||
change_dir(current_dir);
|
||||
}
|
||||
|
||||
DirAccessUnix::RemoveNotificationFunc DirAccessUnix::remove_notification_func = nullptr;
|
||||
|
||||
DirAccessUnix::~DirAccessUnix() {
|
||||
list_dir_end();
|
||||
}
|
||||
|
||||
@ -52,6 +52,9 @@ protected:
|
||||
virtual bool is_hidden(const String &p_name);
|
||||
|
||||
public:
|
||||
typedef void (*RemoveNotificationFunc)(const String &p_file);
|
||||
static RemoveNotificationFunc remove_notification_func;
|
||||
|
||||
virtual Error list_dir_begin() override; ///< This starts dir listing
|
||||
virtual String get_next() override;
|
||||
virtual bool current_is_dir() const override;
|
||||
|
||||
@ -443,7 +443,7 @@ void FileAccessUnix::close() {
|
||||
_close();
|
||||
}
|
||||
|
||||
CloseNotificationFunc FileAccessUnix::close_notification_func = nullptr;
|
||||
FileAccessUnix::CloseNotificationFunc FileAccessUnix::close_notification_func = nullptr;
|
||||
|
||||
FileAccessUnix::~FileAccessUnix() {
|
||||
_close();
|
||||
|
||||
@ -38,8 +38,6 @@
|
||||
|
||||
#if defined(UNIX_ENABLED)
|
||||
|
||||
typedef void (*CloseNotificationFunc)(const String &p_file, int p_flags);
|
||||
|
||||
class FileAccessUnix : public FileAccess {
|
||||
FILE *f = nullptr;
|
||||
int flags = 0;
|
||||
@ -56,6 +54,7 @@ class FileAccessUnix : public FileAccess {
|
||||
#endif
|
||||
|
||||
public:
|
||||
typedef void (*CloseNotificationFunc)(const String &p_file, int p_flags);
|
||||
static CloseNotificationFunc close_notification_func;
|
||||
|
||||
virtual Error open_internal(const String &p_path, int p_mode_flags) override; ///< open a file
|
||||
|
||||
Reference in New Issue
Block a user