From 8db4a7da23c36718152ca29cfb067bcfc759a92f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 5 Feb 2012 17:38:54 +0300 Subject: Move path functions from stringutils to paths. --- src/utils/paths.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/utils/paths.cpp') 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; +} -- cgit v1.2.3-70-g09d2