Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change the path of the Sys folder to the executable's location
  • Loading branch information
strycore committed Nov 7, 2015
1 parent 9731185 commit fe16f39
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Source/Core/Common/FileUtil.cpp
Expand Up @@ -745,6 +745,23 @@ std::string& GetExeDirectory()
}
return DolphinPath;
}
#else
std::string& GetExeDirectory()
{
static std::string DolphinPath;
if (DolphinPath.empty())
{
char Dolphin_exe_Path[PATH_MAX];
ssize_t len = ::readlink("/proc/self/exe", Dolphin_exe_Path, sizeof(Dolphin_exe_Path));
if (len == -1 || len == sizeof(Dolphin_exe_Path)) {
len = 0;
}
Dolphin_exe_Path[len] = '\0';
DolphinPath = Dolphin_exe_Path;
DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of("/"));
}
return DolphinPath;
}
#endif

std::string GetSysDirectory()
Expand All @@ -756,7 +773,8 @@ std::string GetSysDirectory()
#elif defined (_WIN32)
sysDir = GetExeDirectory() + DIR_SEP + SYSDATA_DIR;
#else
sysDir = SYSDATA_DIR;
// sysDir = SYSDATA_DIR;
sysDir = GetExeDirectory() + DIR_SEP + "Sys";
#endif
sysDir += DIR_SEP;

Expand Down
2 changes: 2 additions & 0 deletions Source/Core/Common/FileUtil.h
Expand Up @@ -147,6 +147,8 @@ std::string GetBundleDirectory();

#ifdef _WIN32
std::string &GetExeDirectory();
#else
std::string &GetExeDirectory();
#endif

bool WriteStringToFile(const std::string& str, const std::string& filename);
Expand Down

0 comments on commit fe16f39

Please sign in to comment.