mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-05-06 17:51:36 +02:00
Added a new open method to the directory class, and changed current_is_directory to current_is_dir.
This commit is contained in:
parent
b38b2f4755
commit
0669bbbe55
@ -16,6 +16,22 @@ Error Directory::open(const String &path, bool skip_specials) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Error Directory::open(const char *path, bool skip_specials) {
|
||||||
|
if (_open) {
|
||||||
|
return ERR_CANT_ACQUIRE_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_skip_specials = skip_specials;
|
||||||
|
|
||||||
|
if (tinydir_open(&_dir, path) == -1) {
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
_open = true;
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
void Directory::close() {
|
void Directory::close() {
|
||||||
if (!_open) {
|
if (!_open) {
|
||||||
return;
|
return;
|
||||||
@ -65,7 +81,7 @@ char *Directory::current_get_extension_cstr() {
|
|||||||
bool Directory::current_is_file() {
|
bool Directory::current_is_file() {
|
||||||
return !_file.is_dir;
|
return !_file.is_dir;
|
||||||
}
|
}
|
||||||
bool Directory::current_is_directory() {
|
bool Directory::current_is_dir() {
|
||||||
return _file.is_dir;
|
return _file.is_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ class Directory : public Reference {
|
|||||||
RCPP_OBJECT(Directory, Reference);
|
RCPP_OBJECT(Directory, Reference);
|
||||||
public:
|
public:
|
||||||
Error open(const String &path, bool skip_specials = false);
|
Error open(const String &path, bool skip_specials = false);
|
||||||
|
Error open(const char *path, bool skip_specials = false);
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
bool has_next();
|
bool has_next();
|
||||||
@ -24,7 +25,7 @@ public:
|
|||||||
char *current_get_path_cstr();
|
char *current_get_path_cstr();
|
||||||
char *current_get_extension_cstr();
|
char *current_get_extension_cstr();
|
||||||
bool current_is_file();
|
bool current_is_file();
|
||||||
bool current_is_directory();
|
bool current_is_dir();
|
||||||
|
|
||||||
String read_file(const String &path);
|
String read_file(const String &path);
|
||||||
void read_file_into(const String &path, String *str);
|
void read_file_into(const String &path, String *str);
|
||||||
|
Loading…
Reference in New Issue
Block a user