begin using GetUserDirectory()

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1448 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
bushing 2008-12-08 11:34:26 +00:00
parent d5c9afd449
commit f0758fc3e2
2 changed files with 9 additions and 4 deletions

View File

@ -293,19 +293,24 @@ bool Copy(const char *srcFilename, const char *destFilename)
std::string GetUserDirectory()
{
#ifdef _WIN32
char path[MAX_PATH];
#ifdef _WIN32
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path)))
{
return std::string(path);
}
return std::string("");
#else
char *dir = getenv("HOME");
char *homedir = getenv("HOME");
if (!dir)
return std::string("");
return dir;
#ifdef __APPLE__
snprintf(path, sizeof(path), "%s/Library/Application Support/Dolphin");
#else
snprintf(path, sizeof(path), "%s/.dolphin"); // XXX changeme as appropriate
#endif
#endif
return std::string(path);
}
u64 GetSize(const char *filename)

View File

@ -48,7 +48,7 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
{
// clear tmp folder
{
std::string WiiTempFolder(FULL_WII_USER_DIR "tmp");
std::string WiiTempFolder = File::GetUserDirectory() + FULL_WII_USER_DIR + std::string("tmp");
File::DeleteDirRecursively(WiiTempFolder.c_str());
File::CreateDir(WiiTempFolder.c_str());
}