summaryrefslogtreecommitdiff
path: root/drivers/windows
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-08-10 13:28:47 -0300
committerGitHub <noreply@github.com>2018-08-10 13:28:47 -0300
commit275e0d5ee4e80d9d3cd124ffa29a691b9aed3e70 (patch)
tree6cb7e7f8bec4a2d599ecd0dbbc17f651c56fc710 /drivers/windows
parentb9730a695643af15bd97f9b87ae656b735281bba (diff)
parentd315b0fb8aa03ee6ecc7d93d884b606dc19c6ad5 (diff)
Merge pull request #18914 from notwarp/master
added get_creation_time function for gdscript
Diffstat (limited to 'drivers/windows')
-rw-r--r--drivers/windows/file_access_windows.cpp20
-rw-r--r--drivers/windows/file_access_windows.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index ea194e5eae..c74d8853d4 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -311,6 +311,26 @@ uint64_t FileAccessWindows::_get_modified_time(const String &p_file) {
ERR_FAIL_V(0);
};
+// NEW FUNCTION
+uint64_t FileAccessWindows::_get_creation_time(const String &p_file) {
+
+ String file = fix_path(p_file);
+ if (file.ends_with("/") && file != "/")
+ file = file.substr(0, file.length() - 1);
+
+ struct _stat st;
+ int rv = _wstat(file.c_str(), &st);
+
+ if (rv == 0) {
+
+ return st.st_ctime;
+ } else {
+ print_line("no access to " + file);
+ }
+
+ ERR_FAIL_V(0);
+};
+
FileAccessWindows::FileAccessWindows() {
f = NULL;
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 0462c1e942..ee83acffd7 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -77,6 +77,7 @@ public:
virtual bool file_exists(const String &p_name); ///< return true if a file exists
uint64_t _get_modified_time(const String &p_file);
+ uint64_t _get_creation_time(const String &p_file); // NEW FUNCTION
FileAccessWindows();
virtual ~FileAccessWindows();