summaryrefslogtreecommitdiff
path: root/platform/flash
diff options
context:
space:
mode:
Diffstat (limited to 'platform/flash')
-rw-r--r--platform/flash/dir_access_flash.cpp20
-rw-r--r--platform/flash/dir_access_flash.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/platform/flash/dir_access_flash.cpp b/platform/flash/dir_access_flash.cpp
index a0f1679243..4b8992f9d6 100644
--- a/platform/flash/dir_access_flash.cpp
+++ b/platform/flash/dir_access_flash.cpp
@@ -156,6 +156,26 @@ bool DirAccessFlash::file_exists(String p_file) {
return success;
};
+bool DirAccessFlash::dir_exists(String p_dir) {
+
+ GLOBAL_LOCK_FUNCTION
+
+
+ if (p_dir.is_rel_path())
+ p_dir=current_dir+"/"+p_dir;
+ else
+ p_dir=fix_path(p_dir);
+
+ struct stat flags;
+ bool success = (stat(p_dir.utf8().get_data(),&flags)==0);
+
+ if (success && S_ISDIR(flags.st_mode)) {
+ return true;
+ }
+
+ return false;
+};
+
size_t DirAccessFlash::get_space_left() {
return 0;
diff --git a/platform/flash/dir_access_flash.h b/platform/flash/dir_access_flash.h
index 09e0b844ce..1378a6e56f 100644
--- a/platform/flash/dir_access_flash.h
+++ b/platform/flash/dir_access_flash.h
@@ -45,6 +45,7 @@ public:
Error make_dir(String p_dir);
bool file_exists(String p_file);
+ bool dir_exists(String p_dir);
size_t get_space_left();