summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-05 17:38:54 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-05 17:38:54 +0300
commit8db4a7da23c36718152ca29cfb067bcfc759a92f (patch)
tree0dc6ef2f71248d20a3a00432d644140b4cda68e2
parent261ff1fa32cb75254d68d214f13f8a5aaec33962 (diff)
downloadmanaverse-8db4a7da23c36718152ca29cfb067bcfc759a92f.tar.gz
manaverse-8db4a7da23c36718152ca29cfb067bcfc759a92f.tar.bz2
manaverse-8db4a7da23c36718152ca29cfb067bcfc759a92f.tar.xz
manaverse-8db4a7da23c36718152ca29cfb067bcfc759a92f.zip
Move path functions from stringutils to paths.
-rw-r--r--src/gui/logindialog.cpp1
-rw-r--r--src/gui/updaterwindow.cpp1
-rw-r--r--src/main.cpp1
-rw-r--r--src/net/ea/loginhandler.cpp1
-rw-r--r--src/utils/paths.cpp10
-rw-r--r--src/utils/paths.h2
-rw-r--r--src/utils/stringutils.cpp10
-rw-r--r--src/utils/stringutils.h2
8 files changed, 16 insertions, 12 deletions
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index ef8fd6bf0..cafc4f72c 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -41,6 +41,7 @@
#include "net/net.h"
#include "utils/gettext.h"
+#include "utils/paths.h"
#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index 28bd8467c..3aaf93557 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -42,6 +42,7 @@
#include "resources/resourcemanager.h"
#include "utils/gettext.h"
+#include "utils/paths.h"
#include "utils/stringutils.h"
#include "utils/xml.h"
diff --git a/src/main.cpp b/src/main.cpp
index 5025d6d29..dc87ca9e0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -31,6 +31,7 @@
#include <iostream>
#include <physfs.h>
+#include "utils/paths.h"
#include "utils/stringutils.h"
#include "utils/xml.h"
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 291a92906..39a920f03 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -28,6 +28,7 @@
#include "utils/dtor.h"
#include "utils/gettext.h"
+#include "utils/paths.h"
#include "debug.h"
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index 8decb6e95..faa1882e6 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -55,3 +55,13 @@ bool isRealPath(const std::string &str)
std::string path = getRealPath(str);
return str == path;
}
+
+bool checkPath(std::string path)
+{
+ if (path.empty())
+ return true;
+ return path.find("../") == std::string::npos
+ && path.find("..\\") == std::string::npos
+ && path.find("/..") == std::string::npos
+ && path.find("\\..") == std::string::npos;
+}
diff --git a/src/utils/paths.h b/src/utils/paths.h
index 804900587..f92fcdcb5 100644
--- a/src/utils/paths.h
+++ b/src/utils/paths.h
@@ -27,4 +27,6 @@ std::string getRealPath(const std::string &str);
bool isRealPath(const std::string &str);
+bool checkPath(std::string path);
+
#endif // UTILS_PATHS_H
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index b07a4e367..16542526f 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -592,13 +592,3 @@ std::string &removeProtocol(std::string &url)
url = url.substr(i + 3);
return url;
}
-
-bool checkPath(std::string path)
-{
- if (path.empty())
- return true;
- return path.find("../") == std::string::npos
- && path.find("..\\") == std::string::npos
- && path.find("/..") == std::string::npos
- && path.find("\\..") == std::string::npos;
-}
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index a685a9b17..7b512b081 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -204,6 +204,4 @@ bool findCutFirst(std::string &str1, std::string str2);
std::string &removeProtocol(std::string &url);
-bool checkPath(std::string path);
-
#endif // UTILS_STRINGUTILS_H