Rename DirectoryFileSystem::{physicalPath → PathToPhysical}
This commit is contained in:
parent
770f11a0d1
commit
92a4b2466f
@ -48,7 +48,7 @@ namespace spades {
|
|||||||
|
|
||||||
DirectoryFileSystem::~DirectoryFileSystem() { SPADES_MARK_FUNCTION(); }
|
DirectoryFileSystem::~DirectoryFileSystem() { SPADES_MARK_FUNCTION(); }
|
||||||
|
|
||||||
std::string DirectoryFileSystem::physicalPath(const std::string &lg) {
|
std::string DirectoryFileSystem::PathToPhysical(const std::string &lg) {
|
||||||
// TODO: check ".."?
|
// TODO: check ".."?
|
||||||
return rootPath + '/' + lg;
|
return rootPath + '/' + lg;
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ namespace spades {
|
|||||||
std::vector<std::string> ret;
|
std::vector<std::string> ret;
|
||||||
std::wstring filePath;
|
std::wstring filePath;
|
||||||
|
|
||||||
std::wstring path = Utf8ToWString(physicalPath(p).c_str());
|
std::wstring path = Utf8ToWString(PathToPhysical(p).c_str());
|
||||||
// open the Win32 find handle.
|
// open the Win32 find handle.
|
||||||
h = FindFirstFileExW((path + L"\\*").c_str(), FindExInfoStandard, &fd,
|
h = FindFirstFileExW((path + L"\\*").c_str(), FindExInfoStandard, &fd,
|
||||||
FindExSearchNameMatch, NULL, 0);
|
FindExSearchNameMatch, NULL, 0);
|
||||||
@ -116,7 +116,7 @@ namespace spades {
|
|||||||
#else
|
#else
|
||||||
// open the directory.
|
// open the directory.
|
||||||
|
|
||||||
std::string path = physicalPath(p);
|
std::string path = PathToPhysical(p);
|
||||||
DIR *dir = opendir(path.c_str());
|
DIR *dir = opendir(path.c_str());
|
||||||
struct dirent *ent;
|
struct dirent *ent;
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ namespace spades {
|
|||||||
IStream *DirectoryFileSystem::OpenForReading(const char *fn) {
|
IStream *DirectoryFileSystem::OpenForReading(const char *fn) {
|
||||||
SPADES_MARK_FUNCTION();
|
SPADES_MARK_FUNCTION();
|
||||||
|
|
||||||
std::string path = physicalPath(fn);
|
std::string path = PathToPhysical(fn);
|
||||||
SDL_RWops *f = SDL_RWFromFile(path.c_str(), "rb");
|
SDL_RWops *f = SDL_RWFromFile(path.c_str(), "rb");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
SPRaise("I/O error while opening %s for reading: %s", fn, SDL_GetError());
|
SPRaise("I/O error while opening %s for reading: %s", fn, SDL_GetError());
|
||||||
@ -163,7 +163,7 @@ namespace spades {
|
|||||||
SPRaise("Writing prohibited for root path '%s'", rootPath.c_str());
|
SPRaise("Writing prohibited for root path '%s'", rootPath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string path = physicalPath(fn);
|
std::string path = PathToPhysical(fn);
|
||||||
|
|
||||||
// create required directory
|
// create required directory
|
||||||
if (path.find_first_of("/\\") != std::string::npos) {
|
if (path.find_first_of("/\\") != std::string::npos) {
|
||||||
@ -194,7 +194,7 @@ namespace spades {
|
|||||||
|
|
||||||
bool DirectoryFileSystem::FileExists(const char *fn) {
|
bool DirectoryFileSystem::FileExists(const char *fn) {
|
||||||
SPADES_MARK_FUNCTION();
|
SPADES_MARK_FUNCTION();
|
||||||
std::string path = physicalPath(fn);
|
std::string path = PathToPhysical(fn);
|
||||||
SDL_RWops *f = SDL_RWFromFile(path.c_str(), "rb");
|
SDL_RWops *f = SDL_RWFromFile(path.c_str(), "rb");
|
||||||
if (f) {
|
if (f) {
|
||||||
SDL_RWclose(f);
|
SDL_RWclose(f);
|
||||||
|
@ -29,7 +29,7 @@ namespace spades {
|
|||||||
std::string rootPath;
|
std::string rootPath;
|
||||||
bool canWrite;
|
bool canWrite;
|
||||||
|
|
||||||
std::string physicalPath(const std::string &);
|
std::string PathToPhysical(const std::string &);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DirectoryFileSystem(const std::string &root, bool canWrite = true);
|
DirectoryFileSystem(const std::string &root, bool canWrite = true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user