summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/unix/file_access_unix.cpp6
-rw-r--r--drivers/unix/file_access_unix.h9
2 files changed, 13 insertions, 2 deletions
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 76042089ff..8e70ecc932 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -63,7 +63,7 @@ Error FileAccessUnix::_open(const String& p_path, int p_mode_flags) {
fclose(f);
f=NULL;
- String path=fix_path(p_path);
+ path=fix_path(p_path);
//printf("opening %ls, %i\n", path.c_str(), Memory::get_static_mem_usage());
ERR_FAIL_COND_V(f,ERR_ALREADY_IN_USE);
@@ -114,6 +114,9 @@ void FileAccessUnix::close() {
return;
fclose(f);
f = NULL;
+ if (close_notification_func) {
+ close_notification_func(path,flags);
+ }
if (save_path!="") {
//unlink(save_path.utf8().get_data());
@@ -240,6 +243,7 @@ FileAccess * FileAccessUnix::create_libc() {
return memnew( FileAccessUnix );
}
+CloseNotificationFunc FileAccessUnix::close_notification_func=NULL;
FileAccessUnix::FileAccessUnix() {
diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h
index 5b0f0e7cb7..6c41a51ec5 100644
--- a/drivers/unix/file_access_unix.h
+++ b/drivers/unix/file_access_unix.h
@@ -38,6 +38,10 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
+
+typedef void (*CloseNotificationFunc)(const String& p_file,int p_flags);
+
class FileAccessUnix : public FileAccess {
FILE *f;
@@ -45,10 +49,13 @@ class FileAccessUnix : public FileAccess {
void check_errors() const;
mutable Error last_error;
String save_path;
+ String path;
- static FileAccess* create_libc();
+ static FileAccess* create_libc();
public:
+ static CloseNotificationFunc close_notification_func;
+
virtual Error _open(const String& p_path, int p_mode_flags); ///< open a file
virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open