Renamed Directory to DirAccess for consistency.

This commit is contained in:
Relintai 2024-01-05 23:09:35 +01:00
parent 15d6c92dfd
commit eb81502075
3 changed files with 28 additions and 28 deletions

View File

@ -36,7 +36,7 @@ ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/vector4.cpp -o sfw/core/vecto
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/vector4i.cpp -o sfw/core/vector4i.o
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/file_access.cpp -o sfw/core/file_access.o
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/directory.cpp -o sfw/core/directory.o
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/dir_access.cpp -o sfw/core/dir_access.o
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/pool_vector.cpp -o sfw/core/pool_vector.o
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/pool_allocator.cpp -o sfw/core/pool_allocator.o
@ -105,7 +105,7 @@ ccache g++ -Wall -lm -ldl -lpthread -lX11 -D_REENTRANT -g sfw/core/aabb.o sfw/c
sfw/core/vector2.o sfw/core/vector2i.o sfw/core/vector3.o \
sfw/core/vector3i.o sfw/core/vector4.o sfw/core/vector4i.o \
sfw/core/pool_vector.o sfw/core/pool_allocator.o sfw/core/mutex.o sfw/core/stime.o \
sfw/core/directory.o sfw/core/file_access.o\
sfw/core/dir_access.o sfw/core/file_access.o\
sfw/object/object.o sfw/object/reference.o sfw/object/core_string_names.o \
sfw/object/variant.o sfw/object/variant_op.o sfw/object/psignal.o \
sfw/object/array.o sfw/object/dictionary.o sfw/object/ref_ptr.o \

View File

@ -1,12 +1,12 @@
//--STRIP
#include "directory.h"
#include "dir_access.h"
#include "3rd_tinydir.h"
#include <cstdio>
//--STRIP
Error Directory::open_dir(const String &path, bool skip_specials) {
Error DirAccess::open_dir(const String &path, bool skip_specials) {
if (_dir_open) {
return ERR_CANT_ACQUIRE_RESOURCE;
}
@ -22,7 +22,7 @@ Error Directory::open_dir(const String &path, bool skip_specials) {
return OK;
}
Error Directory::open_dir(const char *path, bool skip_specials) {
Error DirAccess::open_dir(const char *path, bool skip_specials) {
if (_dir_open) {
return ERR_CANT_ACQUIRE_RESOURCE;
}
@ -38,7 +38,7 @@ Error Directory::open_dir(const char *path, bool skip_specials) {
return OK;
}
void Directory::close_dir() {
void DirAccess::close_dir() {
if (!_dir_open) {
return;
}
@ -48,19 +48,19 @@ void Directory::close_dir() {
_dir_open = false;
}
bool Directory::has_next() {
bool DirAccess::has_next() {
if (!_dir) {
return false;
}
return _dir->has_next;
}
bool Directory::read() {
bool DirAccess::read() {
_read_file_result = tinydir_readfile(_dir, _file);
return _read_file_result != -1;
}
bool Directory::next() {
bool DirAccess::next() {
if (!_dir->has_next) {
return false;
}
@ -86,34 +86,34 @@ bool Directory::next() {
return true;
}
bool Directory::current_is_ok() {
bool DirAccess::current_is_ok() {
return _read_file_result == 01;
}
String Directory::current_get_name() {
String DirAccess::current_get_name() {
return String(_file->name);
}
String Directory::current_get_path() {
String DirAccess::current_get_path() {
return String(_file->path);
}
String Directory::current_get_extension() {
String DirAccess::current_get_extension() {
return String(_file->extension);
}
const char *Directory::current_get_name_cstr() {
const char *DirAccess::current_get_name_cstr() {
return _file->name;
}
const char *Directory::current_get_path_cstr() {
const char *DirAccess::current_get_path_cstr() {
return _file->path;
}
const char *Directory::current_get_extension_cstr() {
const char *DirAccess::current_get_extension_cstr() {
return _file->extension;
}
bool Directory::current_is_file() {
bool DirAccess::current_is_file() {
return !_file->is_dir;
}
bool Directory::current_is_dir() {
bool DirAccess::current_is_dir() {
return _file->is_dir;
}
bool Directory::current_is_special_dir() {
bool DirAccess::current_is_special_dir() {
if ((_file->name[0] == '.' && _file->name[1] == '\0') || (_file->name[0] == '.' && _file->name[1] == '.')) {
return true;
}
@ -121,21 +121,21 @@ bool Directory::current_is_special_dir() {
return false;
}
bool Directory::is_dir_open() {
bool DirAccess::is_dir_open() {
return _dir_open;
}
bool Directory::is_dir_closed() {
bool DirAccess::is_dir_closed() {
return !_dir_open;
}
Directory::Directory() {
DirAccess::DirAccess() {
_skip_specials = true;
_read_file_result = 0;
_dir_open = false;
_dir = memnew(tinydir_dir);
_file = memnew(tinydir_file);
}
Directory::~Directory() {
DirAccess::~DirAccess() {
if (is_dir_open()) {
close_dir();
}

View File

@ -1,6 +1,6 @@
#ifndef DIRECTORY_H
#define DIRECTORY_H
#ifndef DIR_ACCESS_H
#define DIR_ACCESS_H
//--STRIP
#include "core/error_list.h"
@ -10,7 +10,7 @@
struct tinydir_file;
struct tinydir_dir;
class Directory {
class DirAccess {
public:
Error open_dir(const String &path, bool skip_specials = true);
Error open_dir(const char *path, bool skip_specials = true);
@ -34,8 +34,8 @@ public:
bool is_dir_open();
bool is_dir_closed();
Directory();
virtual ~Directory();
DirAccess();
virtual ~DirAccess();
private:
bool _skip_specials;