summaryrefslogtreecommitdiff
path: root/src/utils/files.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-14 18:00:20 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-14 18:00:20 +0300
commit5283a59db971ec2038149bf26ad9b3cbc4924449 (patch)
treec2f208b197a3726d6358ca707b64d01887bb6151 /src/utils/files.cpp
parent59146da772888a295bbf8613f32bce5dd7bb00ab (diff)
downloadmv-5283a59db971ec2038149bf26ad9b3cbc4924449.tar.gz
mv-5283a59db971ec2038149bf26ad9b3cbc4924449.tar.bz2
mv-5283a59db971ec2038149bf26ad9b3cbc4924449.tar.xz
mv-5283a59db971ec2038149bf26ad9b3cbc4924449.zip
Add virtlist for file names enumeration in virtfs.
Diffstat (limited to 'src/utils/files.cpp')
-rw-r--r--src/utils/files.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp
index e1685effb..57964f2f3 100644
--- a/src/utils/files.cpp
+++ b/src/utils/files.cpp
@@ -30,6 +30,7 @@
#include "utils/paths.h"
#include "utils/virtfs.h"
#include "utils/virtfstools.h"
+#include "utils/virtlist.h"
#include "utils/stringutils.h"
#include <algorithm>
@@ -48,8 +49,8 @@ void Files::extractLocale()
VirtFs::addZipToSearchPath(fileName2, Append_false);
const std::string localDir = std::string(getenv("APPDIR")).append("/");
- char **rootDirs = VirtFs::enumerateFiles("locale");
- for (char **i = rootDirs; *i; i++)
+ VirtList *const rootDirs = VirtFs::enumerateFiles("locale");
+ FOR_EACH (StringVectCIter, i, rootDirs->names)
{
const std::string dir = std::string("locale/").append(*i);
if (VirtFs::isDirectory(dir.c_str()))
@@ -108,8 +109,8 @@ void Files::copyPhysFsDir(const std::string &restrict inDir,
const std::string &restrict outDir)
{
mkdir_r(outDir.c_str());
- char **files = VirtFs::enumerateFiles(inDir.c_str());
- for (char **i = files; *i; i++)
+ VirtList *const files = VirtFs::enumerateFiles(inDir);
+ FOR_EACH (StringVectCIter, i, files->names)
{
const std::string file = std::string(inDir).append("/").append(*i);
const std::string outDir2 = std::string(outDir).append("/").append(*i);
@@ -210,8 +211,8 @@ int Files::copyFile(const std::string &restrict srcName,
void Files::getFiles(const std::string &path, StringVect &list)
{
- char **const fonts = VirtFs::enumerateFiles(path.c_str());
- for (char *const *i = fonts; *i; i++)
+ VirtList *const fonts = VirtFs::enumerateFiles(path);
+ FOR_EACH (StringVectCIter, i, fonts->names)
{
if (!VirtFs::isDirectory((path + *i).c_str()))
list.push_back(*i);
@@ -221,8 +222,8 @@ void Files::getFiles(const std::string &path, StringVect &list)
void Files::getDirs(const std::string &path, StringVect &list)
{
- char **const fonts = VirtFs::enumerateFiles(path.c_str());
- for (char *const *i = fonts; *i; i++)
+ VirtList *const fonts = VirtFs::enumerateFiles(path);
+ FOR_EACH (StringVectCIter, i, fonts->names)
{
if (VirtFs::isDirectory((path + *i).c_str()))
list.push_back(*i);
@@ -232,8 +233,8 @@ void Files::getDirs(const std::string &path, StringVect &list)
void Files::getFilesWithDir(const std::string &path, StringVect &list)
{
- char **const fonts = VirtFs::enumerateFiles(path.c_str());
- for (char *const *i = fonts; *i; i++)
+ VirtList *const fonts = VirtFs::enumerateFiles(path);
+ FOR_EACH (StringVectCIter, i, fonts->names)
{
if (!VirtFs::isDirectory((path + *i).c_str()))
list.push_back(path + *i);