mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Renamed a few method in Directory.
This commit is contained in:
parent
52f85862bd
commit
5097d210d3
@ -30,7 +30,7 @@ void FileCache::wwwroot_evaluate_dir(const char *path, const bool should_exist)
|
|||||||
Ref<Directory> dir;
|
Ref<Directory> dir;
|
||||||
dir.instance();
|
dir.instance();
|
||||||
|
|
||||||
ERR_FAIL_COND_MSG(!dir->open(path, true), "Error opening wwwroot! folder: " + String(path));
|
ERR_FAIL_COND_MSG(!dir->open_dir(path, true), "Error opening wwwroot! folder: " + String(path));
|
||||||
|
|
||||||
|
|
||||||
while (dir->has_next()) {
|
while (dir->has_next()) {
|
||||||
@ -46,7 +46,7 @@ void FileCache::wwwroot_evaluate_dir(const char *path, const bool should_exist)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dir->close();
|
dir->close_dir();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileCache::get_cached_body(const String &path, String *body) {
|
bool FileCache::get_cached_body(const String &path, String *body) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "directory.h"
|
#include "directory.h"
|
||||||
|
|
||||||
Error Directory::open(const String &path, bool skip_specials) {
|
Error Directory::open_dir(const String &path, bool skip_specials) {
|
||||||
if (_open) {
|
if (_dir_open) {
|
||||||
return ERR_CANT_ACQUIRE_RESOURCE;
|
return ERR_CANT_ACQUIRE_RESOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11,13 +11,13 @@ Error Directory::open(const String &path, bool skip_specials) {
|
|||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
_open = true;
|
_dir_open = true;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error Directory::open(const char *path, bool skip_specials) {
|
Error Directory::open_dir(const char *path, bool skip_specials) {
|
||||||
if (_open) {
|
if (_dir_open) {
|
||||||
return ERR_CANT_ACQUIRE_RESOURCE;
|
return ERR_CANT_ACQUIRE_RESOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,19 +27,19 @@ Error Directory::open(const char *path, bool skip_specials) {
|
|||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
_open = true;
|
_dir_open = true;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Directory::close() {
|
void Directory::close_dir() {
|
||||||
if (!_open) {
|
if (!_dir_open) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tinydir_close(&_dir);
|
tinydir_close(&_dir);
|
||||||
|
|
||||||
_open = false;
|
_dir_open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Directory::has_next() {
|
bool Directory::has_next() {
|
||||||
@ -124,20 +124,20 @@ Error Directory::read_file_into(const String &path, String *str) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Directory::is_open() {
|
bool Directory::is_dir_open() {
|
||||||
return _open;
|
return _dir_open;
|
||||||
}
|
}
|
||||||
bool Directory::is_closed() {
|
bool Directory::is_dir_closed() {
|
||||||
return !_open;
|
return !_dir_open;
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory::Directory() {
|
Directory::Directory() {
|
||||||
_skip_specials = false;
|
_skip_specials = false;
|
||||||
_read_file_result = 0;
|
_read_file_result = 0;
|
||||||
_open = false;
|
_dir_open = false;
|
||||||
}
|
}
|
||||||
Directory::~Directory() {
|
Directory::~Directory() {
|
||||||
if (is_open()) {
|
if (is_dir_open()) {
|
||||||
close();
|
close_dir();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
class Directory : public Reference {
|
class Directory : public Reference {
|
||||||
RCPP_OBJECT(Directory, Reference);
|
RCPP_OBJECT(Directory, Reference);
|
||||||
public:
|
public:
|
||||||
Error open(const String &path, bool skip_specials = true);
|
Error open_dir(const String &path, bool skip_specials = true);
|
||||||
Error open(const char *path, bool skip_specials = true);
|
Error open_dir(const char *path, bool skip_specials = true);
|
||||||
void close();
|
void close_dir();
|
||||||
|
|
||||||
bool has_next();
|
bool has_next();
|
||||||
void next();
|
void next();
|
||||||
@ -30,8 +30,8 @@ public:
|
|||||||
String read_file(const String &path);
|
String read_file(const String &path);
|
||||||
Error read_file_into(const String &path, String *str);
|
Error read_file_into(const String &path, String *str);
|
||||||
|
|
||||||
bool is_open();
|
bool is_dir_open();
|
||||||
bool is_closed();
|
bool is_dir_closed();
|
||||||
|
|
||||||
Directory();
|
Directory();
|
||||||
virtual ~Directory();
|
virtual ~Directory();
|
||||||
@ -42,7 +42,7 @@ private:
|
|||||||
tinydir_dir _dir;
|
tinydir_dir _dir;
|
||||||
tinydir_file _file;
|
tinydir_file _file;
|
||||||
|
|
||||||
bool _open;
|
bool _dir_open;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,7 +47,7 @@ void PagedArticle::load() {
|
|||||||
Ref<Directory> dir;
|
Ref<Directory> dir;
|
||||||
dir.instance();
|
dir.instance();
|
||||||
|
|
||||||
ERR_FAIL_COND_MSG(!dir->open(articles_folder.c_str(), false), "Error opening PagedArticle::folder! folder: " + articles_folder);
|
ERR_FAIL_COND_MSG(!dir->open_dir(articles_folder.c_str(), false), "Error opening PagedArticle::folder! folder: " + articles_folder);
|
||||||
|
|
||||||
Vector<String> files;
|
Vector<String> files;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ void PagedArticle::load() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dir->close();
|
dir->close_dir();
|
||||||
|
|
||||||
if (files.size() == 0) {
|
if (files.size() == 0) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user