summaryrefslogtreecommitdiff
path: root/src/fs/virtfsdir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/virtfsdir.cpp')
-rw-r--r--src/fs/virtfsdir.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/fs/virtfsdir.cpp b/src/fs/virtfsdir.cpp
index 3950aa18c..d27355d40 100644
--- a/src/fs/virtfsdir.cpp
+++ b/src/fs/virtfsdir.cpp
@@ -50,6 +50,7 @@ namespace
{
std::vector<VirtDirEntry*> mEntries;
std::string mWriteDir;
+ std::string mBaseDir;
bool mPermitLinks = false;
VirtFsFuncs funcs;
} // namespace
@@ -252,8 +253,21 @@ namespace VirtFsDir
mEntries.clear();
}
- void init()
+#if defined(__native_client__)
+ void init(const std::string &restrict name A_UNUSED)
{
+ mBaseDir = "/";
+#elif defined(ANDROID)
+ void init(const std::string &restrict name A_UNUSED)
+ {
+ mBaseDir = getRealPath(".");
+#else // defined(__native_client__)
+
+ void init(const std::string &restrict name)
+ {
+ mBaseDir = getRealPath(getFileDir(name));
+#endif // defined(__native_client__)
+
initFuncs(&funcs);
}
@@ -268,6 +282,11 @@ namespace VirtFsDir
ptr->eof = &VirtFsDir::eof;
}
+ const char *getBaseDir()
+ {
+ return mBaseDir.c_str();
+ }
+
std::string getRealDir(const std::string &restrict filename)
{
if (checkPath(filename) == false)