aboutsummaryrefslogtreecommitdiff
path: root/core/os
diff options
context:
space:
mode:
Diffstat (limited to 'core/os')
-rw-r--r--core/os/dir_access.cpp11
-rw-r--r--core/os/dir_access.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index a1031cf5f..d0baae587 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -56,6 +56,17 @@ String DirAccess::_get_root_string() const {
return "";
}
+int DirAccess::get_current_drive() {
+
+ String path = get_current_dir().to_lower();
+ for(int i=0;i<get_drive_count();i++) {
+ String d = get_drive(i).to_lower();
+ if (path.begins_with(d))
+ return i;
+ }
+
+ return 0;
+}
static Error _erase_recursive(DirAccess *da) {
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index 3df9bca45..8bacc96c6 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -84,6 +84,7 @@ public:
virtual int get_drive_count()=0;
virtual String get_drive(int p_drive)=0;
+ virtual int get_current_drive();
virtual Error change_dir(String p_dir)=0; ///< can be relative or absolute, return false on success
virtual String get_current_dir()=0; ///< return current dir location