summaryrefslogtreecommitdiff
path: root/src/fs/virtfsdir.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-27 19:15:04 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-27 19:15:04 +0300
commit36c6674db35445d6c72f0f520b4abf9ef15b4da9 (patch)
treef42ad8dd480c57c3f3e18116dce19da9611d1316 /src/fs/virtfsdir.cpp
parent6388446b85e1fa5deccc6d5c1683fba88ef53d99 (diff)
downloadmv-36c6674db35445d6c72f0f520b4abf9ef15b4da9.tar.gz
mv-36c6674db35445d6c72f0f520b4abf9ef15b4da9.tar.bz2
mv-36c6674db35445d6c72f0f520b4abf9ef15b4da9.tar.xz
mv-36c6674db35445d6c72f0f520b4abf9ef15b4da9.zip
Add own base dir in VirtFsDir.
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)