diff options
| author | JosJuice <josjuice@gmail.com> | 2016-11-24 15:53:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-24 15:53:23 +0100 |
| commit | 9bfea4a0f2f8533ebedeedf809c29bcdb2f4200c (patch) | |
| tree | 44582d689a5d18b4e40b266182315d03b693a055 /Source/Core/Common/FileUtil.cpp | |
| parent | b6f9bdf16bf29a49c6fcf12b07f144d2ccbabbba (diff) | |
| parent | 141f3bfb3acee73569486258c21e4ed34fc32327 (diff) | |
Merge pull request #4447 from JosJuice/hthh-hle-issues
Fix exploitable HLE problems reported by hthh
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
| -rw-r--r-- | Source/Core/Common/FileUtil.cpp | 15 |
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; |
