summaryrefslogtreecommitdiff
path: root/platform/flash
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2014-06-11 01:19:39 -0300
committerreduz <reduzio@gmail.com>2014-06-11 01:19:39 -0300
commitbb0dd1c5f9c1219eb5d4880f5521943f66b8d03f (patch)
treed7bd13bad144c41f2e8bb448d5d233b46402738b /platform/flash
parent2bf34875debd1b60809d22cf61a300b56cdfe084 (diff)
parente6c1689b69e9e0ec530902b550c9e1e2d1cd0aae (diff)
Merge pull request #459 from marynate/PR-diracccess-dir-exists
Add DirAccess:dir_exist api
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();