summaryrefslogtreecommitdiff
path: root/core/os
diff options
context:
space:
mode:
authorDaniele Giuliani <d.giuliani304@gmail.com>2018-05-16 00:50:57 +0200
committerDaniele Giuliani <d.giuliani304@gmail.com>2018-05-16 00:50:57 +0200
commitd315b0fb8aa03ee6ecc7d93d884b606dc19c6ad5 (patch)
tree3ce31259c79d26f74f1dfcd9c9d4a77df261ce61 /core/os
parent005b69cf6e276209464cc8c36ebc7376679925b6 (diff)
added get_creation_time function for gdscript
Diffstat (limited to 'core/os')
-rw-r--r--core/os/file_access.cpp13
-rw-r--r--core/os/file_access.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 033b4b12b9..96ebb79da5 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -489,6 +489,19 @@ uint64_t FileAccess::get_modified_time(const String &p_file) {
memdelete(fa);
return mt;
}
+// NEW FUNCTION
+uint64_t FileAccess::get_creation_time(const String &p_file) {
+
+ if (PackedData::get_singleton() && !PackedData::get_singleton()->is_disabled() && PackedData::get_singleton()->has_path(p_file))
+ return 0;
+
+ FileAccess *fa = create_for_path(p_file);
+ ERR_FAIL_COND_V(!fa, 0);
+
+ uint64_t ct = fa->_get_creation_time(p_file);
+ memdelete(fa);
+ return ct;
+}
void FileAccess::store_string(const String &p_string) {
diff --git a/core/os/file_access.h b/core/os/file_access.h
index c4635fdfbb..2b9477a79c 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -59,6 +59,7 @@ protected:
String fix_path(const String &p_path) const;
virtual Error _open(const String &p_path, int p_mode_flags) = 0; ///< open a file
virtual uint64_t _get_modified_time(const String &p_file) = 0;
+ virtual uint64_t _get_creation_time(const String &p_file) = 0; // NEW FUNCTION
static FileCloseFailNotify close_fail_notify;
@@ -153,6 +154,7 @@ public:
static CreateFunc get_create_func(AccessType p_access);
static bool exists(const String &p_name); ///< return true if a file exists
static uint64_t get_modified_time(const String &p_file);
+ static uint64_t get_creation_time(const String &p_file); // NEW FUNCTION
static void set_backup_save(bool p_enable) { backup_save = p_enable; };
static bool is_backup_save_enabled() { return backup_save; };