mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Create a dir for setting.txt to
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1328 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -149,6 +149,49 @@ bool CreateDir(const char *path)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Create several dirs
|
||||
bool CreateDirectoryStructure(const std::string& _rFullPath)
|
||||
{
|
||||
int PanicCounter = 10;
|
||||
|
||||
size_t Position = 0;
|
||||
while(true)
|
||||
{
|
||||
// find next sub path
|
||||
{
|
||||
size_t nextPosition = _rFullPath.find('/', Position);
|
||||
if (nextPosition == std::string::npos)
|
||||
nextPosition = _rFullPath.find('\\', Position);
|
||||
Position = nextPosition;
|
||||
|
||||
if (Position == std::string::npos)
|
||||
return true;
|
||||
|
||||
Position++;
|
||||
}
|
||||
|
||||
// create next sub path
|
||||
std::string SubPath = _rFullPath.substr(0, Position);
|
||||
if (!SubPath.empty())
|
||||
{
|
||||
if (!File::IsDirectory(SubPath.c_str()))
|
||||
{
|
||||
File::CreateDir(SubPath.c_str());
|
||||
LOG(WII_IPC_FILEIO, " CreateSubDir %s", SubPath.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// just a safty check...
|
||||
PanicCounter--;
|
||||
if (PanicCounter <= 0)
|
||||
{
|
||||
PanicAlert("CreateDirectoryStruct creates way to much dirs...");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DeleteDir(const char *filename)
|
||||
{
|
||||
|
||||
|
@ -41,6 +41,7 @@ void Launch(const char *filename);
|
||||
void Explore(const char *path);
|
||||
bool IsDirectory(const char *filename);
|
||||
bool CreateDir(const char *filename);
|
||||
bool CreateDirectoryStructure(const std::string& _rFullPath);
|
||||
bool Delete(const char *filename);
|
||||
bool DeleteDir(const char *filename);
|
||||
bool Rename(const char *srcFilename, const char *destFilename);
|
||||
|
Reference in New Issue
Block a user