summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-10 01:50:12 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-10 02:35:02 +0300
commit2317fbe9d29f5bea76a2ba05b40841b11de1a6f2 (patch)
tree121a1cdf207e47798050bf648265bb9b3f9ef65f
parent0b4614a2d3dee49097b8131150df21ef585bf854 (diff)
downloadplus-2317fbe9d29f5bea76a2ba05b40841b11de1a6f2.tar.gz
plus-2317fbe9d29f5bea76a2ba05b40841b11de1a6f2.tar.bz2
plus-2317fbe9d29f5bea76a2ba05b40841b11de1a6f2.tar.xz
plus-2317fbe9d29f5bea76a2ba05b40841b11de1a6f2.zip
fix dirs and files enumeration in some systems.
-rw-r--r--src/gui/theme.cpp2
-rw-r--r--src/resources/beingcommon.cpp4
-rw-r--r--src/utils/files.cpp11
-rw-r--r--src/utils/files.h2
4 files changed, 17 insertions, 2 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index f329ada74..d78a5d5f5 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -650,7 +650,7 @@ bool Theme::tryThemePath(const std::string &themeName)
void Theme::fillSkinsList(StringVect &list)
{
- Files::getFiles(branding.getStringValue("guiThemePath"), list);
+ Files::getDirs(branding.getStringValue("guiThemePath"), list);
}
void Theme::fillFontsList(StringVect &list)
diff --git a/src/resources/beingcommon.cpp b/src/resources/beingcommon.cpp
index 5647d01e3..3e3a81cbf 100644
--- a/src/resources/beingcommon.cpp
+++ b/src/resources/beingcommon.cpp
@@ -20,6 +20,8 @@
#include "resources/beingcommon.h"
+#include "logger.h"
+
#include "utils/files.h"
#include "utils/physfstools.h"
#include "utils/stringutils.h"
@@ -51,7 +53,7 @@ void BeingCommon::readBasicAttributes(BeingInfo *const info, XmlNodePtr node,
void BeingCommon::getIncludeFiles(const std::string &dir, StringVect &list)
{
- const std::string path = dir + PhysFs::getDirSeparator();
+ const std::string path = dir + "/";
StringVect tempList;
Files::getFilesWithDir(path, tempList);
FOR_EACH (StringVectCIter, it, tempList)
diff --git a/src/utils/files.cpp b/src/utils/files.cpp
index 9abf13593..39451b129 100644
--- a/src/utils/files.cpp
+++ b/src/utils/files.cpp
@@ -208,6 +208,17 @@ void Files::getFiles(const std::string &path, StringVect &list)
PhysFs::freeList(fonts);
}
+void Files::getDirs(const std::string &path, StringVect &list)
+{
+ char **fonts = PhysFs::enumerateFiles(path.c_str());
+ for (char **i = fonts; *i; i++)
+ {
+ if (PhysFs::isDirectory((path + *i).c_str()))
+ list.push_back(*i);
+ }
+ PhysFs::freeList(fonts);
+}
+
void Files::getFilesWithDir(const std::string &path, StringVect &list)
{
char **fonts = PhysFs::enumerateFiles(path.c_str());
diff --git a/src/utils/files.h b/src/utils/files.h
index 9363f96da..2046b8ac9 100644
--- a/src/utils/files.h
+++ b/src/utils/files.h
@@ -57,6 +57,8 @@ namespace Files
void getFiles(const std::string &path, StringVect &list);
+ void getDirs(const std::string &path, StringVect &list);
+
void getFilesWithDir(const std::string &restrict path,
StringVect &restrict list);
} // namespace Files