summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-14 09:16:41 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-14 09:17:15 -0300
commitda4170540cbe3dcec4855ddbb59edf1abd7cf9b4 (patch)
tree873e57d1fdbf5cfe414c9610068e78ce0d4258db
parent7b9f2d9929d0e8516d42379962533df823c7c550 (diff)
Fixed dir access return value, changed it to Error like all other funcs
-rw-r--r--core/bind/core_bind.cpp4
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/io/file_access_pack.cpp4
-rw-r--r--core/io/file_access_pack.h2
-rw-r--r--core/os/dir_access.h2
-rw-r--r--drivers/unix/dir_access_unix.cpp6
-rw-r--r--drivers/unix/dir_access_unix.h2
-rw-r--r--drivers/windows/dir_access_windows.cpp4
-rw-r--r--platform/android/dir_access_android.cpp6
-rw-r--r--platform/android/dir_access_android.h2
-rw-r--r--platform/android/dir_access_jandroid.cpp6
-rw-r--r--platform/android/dir_access_jandroid.h2
12 files changed, 21 insertions, 21 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index fe2be260d7..ab3e340a8b 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -1830,9 +1830,9 @@ Error _Directory::open(const String& p_path) {
return OK;
}
-bool _Directory::list_dir_begin() {
+Error _Directory::list_dir_begin() {
- ERR_FAIL_COND_V(!d,false);
+ ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED);
return d->list_dir_begin();
}
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 0774492f66..5b32aaa9cd 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -456,7 +456,7 @@ public:
Error open(const String& p_path);
- bool list_dir_begin(); ///< This starts dir listing
+ Error list_dir_begin(); ///< This starts dir listing
String get_next();
bool current_is_dir() const;
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 7e3a6d1fa0..d63539a7a5 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -340,7 +340,7 @@ FileAccessPack::~FileAccessPack() {
//////////////////////////////////////////////////////////////////////////////////
-bool DirAccessPack::list_dir_begin() {
+Error DirAccessPack::list_dir_begin() {
list_dirs.clear();
@@ -356,7 +356,7 @@ bool DirAccessPack::list_dir_begin() {
list_files.push_back(E->get());
}
- return true;
+ return OK;
}
String DirAccessPack::get_next(){
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 83340a662b..0a1320e57b 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -209,7 +209,7 @@ class DirAccessPack : public DirAccess {
public:
- virtual bool list_dir_begin();
+ virtual Error list_dir_begin();
virtual String get_next();
virtual bool current_is_dir() const;
virtual bool current_is_hidden() const;
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index f824b5f319..7c173fc780 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -72,7 +72,7 @@ protected:
public:
- virtual bool list_dir_begin()=0; ///< This starts dir listing
+ virtual Error list_dir_begin()=0; ///< This starts dir listing
virtual String get_next(bool* p_is_dir); // compatibility
virtual String get_next()=0;
virtual bool current_is_dir() const=0;
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 3bb30700db..890b6b17bc 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -44,7 +44,7 @@ DirAccess *DirAccessUnix::create_fs() {
return memnew( DirAccessUnix );
}
-bool DirAccessUnix::list_dir_begin() {
+Error DirAccessUnix::list_dir_begin() {
list_dir_end(); //close any previous dir opening!
@@ -55,9 +55,9 @@ bool DirAccessUnix::list_dir_begin() {
dir_stream = opendir(current_dir.utf8().get_data());
//chdir(real_current_dir_name);
if (!dir_stream)
- return true; //error!
+ return ERR_CANT_OPEN; //error!
- return false;
+ return OK;
}
bool DirAccessUnix::file_exists(String p_file) {
diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h
index 324d2a379c..f075c48268 100644
--- a/drivers/unix/dir_access_unix.h
+++ b/drivers/unix/dir_access_unix.h
@@ -57,7 +57,7 @@ protected:
public:
- virtual bool list_dir_begin(); ///< This starts dir listing
+ virtual Error list_dir_begin(); ///< This starts dir listing
virtual String get_next();
virtual bool current_is_dir() const;
virtual bool current_is_hidden() const;
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index c7082dbc7c..14742aa420 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -59,7 +59,7 @@ struct DirAccessWindowsPrivate {
// CreateFolderAsync
-bool DirAccessWindows::list_dir_begin() {
+Error DirAccessWindows::list_dir_begin() {
_cisdir=false;
_cishidden=false;
@@ -67,7 +67,7 @@ bool DirAccessWindows::list_dir_begin() {
list_dir_end();
p->h = FindFirstFileExW((current_dir+"\\*").c_str(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0);
- return (p->h==INVALID_HANDLE_VALUE);
+ return (p->h==INVALID_HANDLE_VALUE) ? ERR_CANT_OPEN : OK;
}
diff --git a/platform/android/dir_access_android.cpp b/platform/android/dir_access_android.cpp
index f1a488cec2..42ac34a589 100644
--- a/platform/android/dir_access_android.cpp
+++ b/platform/android/dir_access_android.cpp
@@ -37,16 +37,16 @@ DirAccess *DirAccessAndroid::create_fs() {
return memnew(DirAccessAndroid);
}
-bool DirAccessAndroid::list_dir_begin() {
+Error DirAccessAndroid::list_dir_begin() {
list_dir_end();
AAssetDir* aad = AAssetManager_openDir(FileAccessAndroid::asset_manager,current_dir.utf8().get_data());
if (!aad)
- return true; //nothing
+ return ERR_CANT_OPEN; //nothing
- return false;
+ return OK;
}
String DirAccessAndroid::get_next(){
diff --git a/platform/android/dir_access_android.h b/platform/android/dir_access_android.h
index 15c29a9a02..72611ceb59 100644
--- a/platform/android/dir_access_android.h
+++ b/platform/android/dir_access_android.h
@@ -49,7 +49,7 @@ class DirAccessAndroid : public DirAccess {
public:
- virtual bool list_dir_begin(); ///< This starts dir listing
+ virtual Error list_dir_begin(); ///< This starts dir listing
virtual String get_next();
virtual bool current_is_dir() const;
virtual bool current_is_hidden() const;
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index bbd041f6c7..b6d4f757f9 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -47,7 +47,7 @@ DirAccess *DirAccessJAndroid::create_fs() {
return memnew(DirAccessJAndroid);
}
-bool DirAccessJAndroid::list_dir_begin() {
+Error DirAccessJAndroid::list_dir_begin() {
list_dir_end();
JNIEnv *env = ThreadAndroid::get_env();
@@ -55,11 +55,11 @@ bool DirAccessJAndroid::list_dir_begin() {
jstring js = env->NewStringUTF(current_dir.utf8().get_data());
int res = env->CallIntMethod(io,_dir_open,js);
if (res<=0)
- return true;
+ return ERR_CANT_OPEN;
id=res;
- return false;
+ return OK;
}
String DirAccessJAndroid::get_next(){
diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h
index bfd7912aaf..5db32b945c 100644
--- a/platform/android/dir_access_jandroid.h
+++ b/platform/android/dir_access_jandroid.h
@@ -58,7 +58,7 @@ class DirAccessJAndroid : public DirAccess {
public:
- virtual bool list_dir_begin(); ///< This starts dir listing
+ virtual Error list_dir_begin(); ///< This starts dir listing
virtual String get_next();
virtual bool current_is_dir() const;
virtual bool current_is_hidden() const;