summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 39f14a646..26accbc7d 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -509,6 +509,19 @@ std::vector<std::string> getLang()
return langs;
}
+std::string getLangSimple()
+{
+ std::string lang = config.getValue("lang", "").c_str();
+ if (lang.empty())
+ {
+ char *lng = getenv("LANG");
+ if (!lng)
+ return "";
+ return lng;
+ }
+ return lang;
+}
+
std::string packList(std::list<std::string> &list)
{
std::list<std::string>::const_iterator i = list.begin();
@@ -612,3 +625,13 @@ 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;
+}