mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
added GetCurrentDirectory function
some times "something" changes the current directory if you open a file with the file browser dialog... i need this function to investigate the problem :) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1357 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -20,10 +20,11 @@
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shlobj.h> // for SHGetFolderPath
|
#include <shlobj.h> // for SHGetFolderPath
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <commdlg.h> // for GetSaveFileName
|
#include <commdlg.h> // for GetSaveFileName
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#include <direct.h> // getcwd
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
@ -224,7 +225,7 @@ bool Rename(const char *srcFilename, const char *destFilename)
|
|||||||
bool Copy(const char *srcFilename, const char *destFilename)
|
bool Copy(const char *srcFilename, const char *destFilename)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return CopyFile(srcFilename, destFilename, FALSE);
|
return (CopyFile(srcFilename, destFilename, FALSE) == TRUE) ? true : false;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define BSIZE 1024
|
#define BSIZE 1024
|
||||||
@ -478,4 +479,16 @@ error_jmp:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetCurrentDirectory(std::string& _rDirectory)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
char tmpBuffer[MAX_PATH+1];
|
||||||
|
getcwd(tmpBuffer, MAX_PATH);
|
||||||
|
_rDirectory = tmpBuffer;
|
||||||
|
#else
|
||||||
|
PanicAlert("Missing Linux support of GetCurrentDirectory");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -53,6 +53,7 @@ bool CreateEmptyFile(const char *filename);
|
|||||||
u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry);
|
u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry);
|
||||||
|
|
||||||
bool DeleteDirRecursively(const std::string& _Directory);
|
bool DeleteDirRecursively(const std::string& _Directory);
|
||||||
|
void GetCurrentDirectory(std::string& _rDirectory);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user