summaryrefslogtreecommitdiff
path: root/src/utils/virtfs.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-15 03:36:05 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-15 03:36:05 +0300
commit35ff05fe5c98a26581a9282730a0a624605b70e1 (patch)
treec32a73d801fe7b0fb939f230394ddcedbae391bb /src/utils/virtfs.cpp
parent8580c1f1b4e460536102798acca9f14c5e62b871 (diff)
downloadManaVerse-35ff05fe5c98a26581a9282730a0a624605b70e1.tar.gz
ManaVerse-35ff05fe5c98a26581a9282730a0a624605b70e1.tar.bz2
ManaVerse-35ff05fe5c98a26581a9282730a0a624605b70e1.tar.xz
ManaVerse-35ff05fe5c98a26581a9282730a0a624605b70e1.zip
Add more unit tests for virtfs.
Also add some testing files.
Diffstat (limited to 'src/utils/virtfs.cpp')
-rw-r--r--src/utils/virtfs.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/utils/virtfs.cpp b/src/utils/virtfs.cpp
index 5fcb568d3..7c67deebc 100644
--- a/src/utils/virtfs.cpp
+++ b/src/utils/virtfs.cpp
@@ -197,9 +197,12 @@ namespace VirtFs
return PHYSFS_removeFromSearchPath(oldDir.c_str());
}
- const char *getRealDir(const std::string &restrict filename)
+ std::string getRealDir(const std::string &restrict filename)
{
- return PHYSFS_getRealDir(filename.c_str());
+ const char *const str = PHYSFS_getRealDir(filename.c_str());
+ if (str == nullptr)
+ return std::string();
+ return str;
}
bool mkdir(const std::string &restrict dirname)
@@ -207,6 +210,11 @@ namespace VirtFs
return PHYSFS_mkdir(dirname.c_str());
}
+ bool remove(const std::string &restrict filename)
+ {
+ return PHYSFS_delete(filename.c_str());
+ }
+
bool deinit()
{
if (PHYSFS_deinit() != 0)