mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 22:49:00 +01:00
Change the initial user directory creation to stop special casing Windows
This commit is contained in:
parent
dfcef6890e
commit
b587af3ea3
@ -38,6 +38,7 @@
|
|||||||
// Shared data dirs (Sys and shared User for linux)
|
// Shared data dirs (Sys and shared User for linux)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define SYSDATA_DIR "Sys"
|
#define SYSDATA_DIR "Sys"
|
||||||
|
#define SHARED_USER_DIR File::GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP
|
||||||
#elif defined __APPLE__
|
#elif defined __APPLE__
|
||||||
#define SYSDATA_DIR "Contents/Resources/Sys"
|
#define SYSDATA_DIR "Contents/Resources/Sys"
|
||||||
#define SHARED_USER_DIR File::GetBundleDirectory() + \
|
#define SHARED_USER_DIR File::GetBundleDirectory() + \
|
||||||
|
@ -551,11 +551,24 @@ bool DeleteDirRecursively(const std::string &directory)
|
|||||||
// Create directory and copy contents (does not overwrite existing files)
|
// Create directory and copy contents (does not overwrite existing files)
|
||||||
void CopyDir(const std::string &source_path, const std::string &dest_path)
|
void CopyDir(const std::string &source_path, const std::string &dest_path)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
if (source_path == dest_path) return;
|
if (source_path == dest_path) return;
|
||||||
if (!File::Exists(source_path)) return;
|
if (!File::Exists(source_path)) return;
|
||||||
if (!File::Exists(dest_path)) File::CreateFullPath(dest_path);
|
if (!File::Exists(dest_path)) File::CreateFullPath(dest_path);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
WIN32_FIND_DATA ffd;
|
||||||
|
HANDLE hFind = FindFirstFile(UTF8ToTStr(source_path + "\\*").c_str(), &ffd);
|
||||||
|
|
||||||
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
FindClose(hFind);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
const std::string virtualName(TStrToUTF8(ffd.cFileName));
|
||||||
|
#else
|
||||||
struct dirent dirent, *result = NULL;
|
struct dirent dirent, *result = NULL;
|
||||||
DIR *dirp = opendir(source_path.c_str());
|
DIR *dirp = opendir(source_path.c_str());
|
||||||
if (!dirp) return;
|
if (!dirp) return;
|
||||||
@ -563,10 +576,9 @@ void CopyDir(const std::string &source_path, const std::string &dest_path)
|
|||||||
while (!readdir_r(dirp, &dirent, &result) && result)
|
while (!readdir_r(dirp, &dirent, &result) && result)
|
||||||
{
|
{
|
||||||
const std::string virtualName(result->d_name);
|
const std::string virtualName(result->d_name);
|
||||||
|
#endif
|
||||||
// check for "." and ".."
|
// check for "." and ".."
|
||||||
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
|
if (virtualName == "." || virtualName == "..")
|
||||||
((virtualName[0] == '.') && (virtualName[1] == '.') &&
|
|
||||||
(virtualName[2] == '\0')))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string source, dest;
|
std::string source, dest;
|
||||||
@ -580,6 +592,10 @@ void CopyDir(const std::string &source_path, const std::string &dest_path)
|
|||||||
CopyDir(source, dest);
|
CopyDir(source, dest);
|
||||||
}
|
}
|
||||||
else if (!File::Exists(dest)) File::Copy(source, dest);
|
else if (!File::Exists(dest)) File::Copy(source, dest);
|
||||||
|
#ifdef _WIN32
|
||||||
|
} while (FindNextFile(hFind, &ffd) != 0);
|
||||||
|
FindClose(hFind);
|
||||||
|
#else
|
||||||
}
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
#endif
|
#endif
|
||||||
@ -643,9 +659,9 @@ std::string GetSysDirectory()
|
|||||||
std::string sysDir;
|
std::string sysDir;
|
||||||
|
|
||||||
#if defined (__APPLE__)
|
#if defined (__APPLE__)
|
||||||
sysDir = GetBundleDirectory();
|
sysDir = GetBundleDirectory() + DIR_SEP + SYSDATA_DIR;
|
||||||
sysDir += DIR_SEP;
|
#elif defined (_WIN32)
|
||||||
sysDir += SYSDATA_DIR;
|
sysDir = GetExeDirectory() + DIR_SEP + SYSDATA_DIR;
|
||||||
#else
|
#else
|
||||||
sysDir = SYSDATA_DIR;
|
sysDir = SYSDATA_DIR;
|
||||||
#endif
|
#endif
|
||||||
|
@ -249,12 +249,6 @@ bool DolphinApp::OnInit()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
if (!wxSetWorkingDirectory(StrToWxStr(File::GetExeDirectory())))
|
|
||||||
{
|
|
||||||
INFO_LOG(CONSOLE, "Set working directory failed");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
//create all necessary directories in user directory
|
//create all necessary directories in user directory
|
||||||
//TODO : detect the revision and upgrade where necessary
|
//TODO : detect the revision and upgrade where necessary
|
||||||
File::CopyDir(std::string(SHARED_USER_DIR GAMECONFIG_DIR DIR_SEP),
|
File::CopyDir(std::string(SHARED_USER_DIR GAMECONFIG_DIR DIR_SEP),
|
||||||
@ -267,7 +261,7 @@ bool DolphinApp::OnInit()
|
|||||||
File::GetUserPath(D_WIIUSER_IDX));
|
File::GetUserPath(D_WIIUSER_IDX));
|
||||||
File::CopyDir(std::string(SHARED_USER_DIR OPENCL_DIR DIR_SEP),
|
File::CopyDir(std::string(SHARED_USER_DIR OPENCL_DIR DIR_SEP),
|
||||||
File::GetUserPath(D_OPENCL_IDX));
|
File::GetUserPath(D_OPENCL_IDX));
|
||||||
#endif
|
|
||||||
File::CreateFullPath(File::GetUserPath(D_USER_IDX));
|
File::CreateFullPath(File::GetUserPath(D_USER_IDX));
|
||||||
File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX));
|
File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX));
|
||||||
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
|
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user