summaryrefslogtreecommitdiff
path: root/src/utils/virtfstools.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/virtfstools.cpp
parent8580c1f1b4e460536102798acca9f14c5e62b871 (diff)
downloadmv-35ff05fe5c98a26581a9282730a0a624605b70e1.tar.gz
mv-35ff05fe5c98a26581a9282730a0a624605b70e1.tar.bz2
mv-35ff05fe5c98a26581a9282730a0a624605b70e1.tar.xz
mv-35ff05fe5c98a26581a9282730a0a624605b70e1.zip
Add more unit tests for virtfs.
Also add some testing files.
Diffstat (limited to 'src/utils/virtfstools.cpp')
-rw-r--r--src/utils/virtfstools.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/utils/virtfstools.cpp b/src/utils/virtfstools.cpp
index e4b4d02cf..adc1c9772 100644
--- a/src/utils/virtfstools.cpp
+++ b/src/utils/virtfstools.cpp
@@ -49,7 +49,7 @@ namespace VirtFs
}
logger->log("Loaded %s/%s",
- VirtFs::getRealDir(fileName),
+ VirtFs::getRealDir(fileName).c_str(),
fileName.c_str());
fileSize = CAST_S32(VirtFs::fileLength(file));
@@ -75,8 +75,7 @@ namespace VirtFs
!ext.compare(str.substr(len - ext.length())))
{
const std::string file = path + str;
- const std::string realPath = std::string(
- VirtFs::getRealDir(file));
+ const std::string realPath = VirtFs::getRealDir(file);
VirtFs::addZipToSearchPath(std::string(realPath).append(
dirSeparator).append(file), append);
}
@@ -96,8 +95,7 @@ namespace VirtFs
!ext.compare(str.substr(len - ext.length())))
{
const std::string file = path + str;
- const std::string realPath = std::string(
- VirtFs::getRealDir(file));
+ const std::string realPath = VirtFs::getRealDir(file);
VirtFs::removeZipFromSearchPath(std::string(
realPath).append(
dirSeparator).append(
@@ -141,7 +139,7 @@ namespace VirtFs
VirtList *const fonts = VirtFs::enumerateFiles(path);
FOR_EACH (StringVectCIter, i, fonts->names)
{
- if (!VirtFs::isDirectory(path + *i))
+ if (!VirtFs::isDirectory(path + dirSeparator + *i))
list.push_back(*i);
}
VirtFs::freeList(fonts);
@@ -152,7 +150,7 @@ namespace VirtFs
VirtList *const fonts = VirtFs::enumerateFiles(path);
FOR_EACH (StringVectCIter, i, fonts->names)
{
- if (VirtFs::isDirectory(path + *i))
+ if (VirtFs::isDirectory(path + dirSeparator + *i))
list.push_back(*i);
}
VirtFs::freeList(fonts);
@@ -161,11 +159,11 @@ namespace VirtFs
std::string getPath(const std::string &file)
{
// get the real path to the file
- const char *const tmp = VirtFs::getRealDir(file);
+ const std::string tmp = VirtFs::getRealDir(file);
std::string path;
- // if the file is not in the search path, then its nullptr
- if (tmp)
+ // if the file is not in the search path, then its empty
+ if (!tmp.empty())
{
path = std::string(tmp).append(dirSeparator).append(file);
#if defined __native_client__