summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FileUtil.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2016-11-12 20:48:50 +0100
committerJosJuice <josjuice@gmail.com>2016-11-13 10:03:23 +0100
commit141f3bfb3acee73569486258c21e4ed34fc32327 (patch)
treedc8fbe9dc3b0104a387dd0feba607e4b5b621587 /Source/Core/Common/FileUtil.cpp
parenta79c4494938f6ca1a7fe1899c86037488b6a06cd (diff)
IOS HLE: Prevent accessing host file system
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
-rw-r--r--Source/Core/Common/FileUtil.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp
index e761f3ade1..acf154f81a 100644
--- a/Source/Core/Common/FileUtil.cpp
+++ b/Source/Core/Common/FileUtil.cpp
@@ -5,6 +5,7 @@
#include <algorithm>
#include <cstddef>
#include <cstdio>
+#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <limits.h>
@@ -30,7 +31,6 @@
#include <dirent.h>
#include <errno.h>
#include <libgen.h>
-#include <stdlib.h>
#include <unistd.h>
#endif
@@ -712,6 +712,19 @@ std::string GetBundleDirectory()
}
#endif
+std::string GetAbsolutePath(const std::string& path)
+{
+#ifdef _WIN32
+ wchar_t absolute_path[_MAX_PATH];
+ wchar_t* result = _wfullpath(absolute_path, UTF8ToTStr(path).c_str(), _MAX_PATH);
+ return result ? TStrToUTF8(result) : "";
+#else
+ char absolute_path[MAX_PATH + 1];
+ char* result = realpath(path.c_str(), absolute_path);
+ return result ? result : "";
+#endif
+}
+
std::string& GetExeDirectory()
{
static std::string DolphinPath;