mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-04-20 01:43:12 +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;
|
||||
}
|
||||
|
||||
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() {
|
||||
if (!_open) {
|
||||
return;
|
||||
@ -65,7 +81,7 @@ char *Directory::current_get_extension_cstr() {
|
||||
bool Directory::current_is_file() {
|
||||
return !_file.is_dir;
|
||||
}
|
||||
bool Directory::current_is_directory() {
|
||||
bool Directory::current_is_dir() {
|
||||
return _file.is_dir;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ class Directory : public Reference {
|
||||
RCPP_OBJECT(Directory, Reference);
|
||||
public:
|
||||
Error open(const String &path, bool skip_specials = false);
|
||||
Error open(const char *path, bool skip_specials = false);
|
||||
void close();
|
||||
|
||||
bool has_next();
|
||||
@ -24,7 +25,7 @@ public:
|
||||
char *current_get_path_cstr();
|
||||
char *current_get_extension_cstr();
|
||||
bool current_is_file();
|
||||
bool current_is_directory();
|
||||
bool current_is_dir();
|
||||
|
||||
String read_file(const String &path);
|
||||
void read_file_into(const String &path, String *str);
|
||||
|
Loading…
Reference in New Issue
Block a user