2022-02-04 23:17:46 +01:00
|
|
|
#ifndef DIRECTORY_H
|
|
|
|
#define DIRECTORY_H
|
|
|
|
|
|
|
|
#include "core/string.h"
|
|
|
|
#include "core/error_list.h"
|
|
|
|
#include <tinydir/tinydir.h>
|
|
|
|
|
|
|
|
#include "core/reference.h"
|
|
|
|
|
|
|
|
class Directory : public Reference {
|
|
|
|
RCPP_OBJECT(Directory, Reference);
|
|
|
|
public:
|
2022-02-04 23:27:37 +01:00
|
|
|
Error open(const String &path, bool skip_specials = true);
|
|
|
|
Error open(const char *path, bool skip_specials = true);
|
2022-02-04 23:17:46 +01:00
|
|
|
void close();
|
|
|
|
|
|
|
|
bool has_next();
|
|
|
|
void next();
|
|
|
|
|
|
|
|
bool current_is_ok();
|
|
|
|
String current_get_name();
|
|
|
|
String current_get_path();
|
|
|
|
String current_get_extension();
|
|
|
|
char *current_get_name_cstr();
|
|
|
|
char *current_get_path_cstr();
|
|
|
|
char *current_get_extension_cstr();
|
|
|
|
bool current_is_file();
|
2022-02-04 23:25:09 +01:00
|
|
|
bool current_is_dir();
|
2022-02-04 23:17:46 +01:00
|
|
|
|
|
|
|
String read_file(const String &path);
|
2022-02-04 23:33:39 +01:00
|
|
|
Error read_file_into(const String &path, String *str);
|
2022-02-04 23:17:46 +01:00
|
|
|
|
|
|
|
bool is_open();
|
|
|
|
bool is_closed();
|
|
|
|
|
|
|
|
Directory();
|
|
|
|
virtual ~Directory();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool _skip_specials;
|
|
|
|
int _read_file_result;
|
|
|
|
tinydir_dir _dir;
|
|
|
|
tinydir_file _file;
|
|
|
|
|
|
|
|
bool _open;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|