fix CreateFullPath, fix memcards not being created if the path didn't exist for some reason, don't put dsptool .pdb files in the binary dir

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2984 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-04-16 17:24:06 +00:00
parent 508b32b94f
commit e6dbfb4f24
3 changed files with 15 additions and 12 deletions

View File

@ -172,9 +172,13 @@ bool CreateFullPath(const char *fullPath)
return true; return true;
} }
const char *position = fullPath; // safety check to ensure we have good dir seperators
std::string strFullPath(fullPath);
NormalizeDirSep(&strFullPath);
const char *position = strFullPath.c_str();
while (true) { while (true) {
// Find next sub path, support both \ and / directory separators // Find next sub path
position = strchr(position, DIR_SEP_CHR); position = strchr(position, DIR_SEP_CHR);
// we're done, yay! // we're done, yay!
@ -184,9 +188,9 @@ bool CreateFullPath(const char *fullPath)
position++; position++;
// Create next sub path // Create next sub path
int sLen = (int)(position - fullPath); int sLen = (int)(position - strFullPath.c_str());
if (sLen > 0) { if (sLen > 0) {
char *subPath = strndup(fullPath, sLen); char *subPath = strndup(strFullPath.c_str(), sLen);
if (!File::IsDirectory(subPath)) { if (!File::IsDirectory(subPath)) {
File::CreateDir(subPath); File::CreateDir(subPath);
} }
@ -196,7 +200,7 @@ bool CreateFullPath(const char *fullPath)
// A safety check // A safety check
panicCounter--; panicCounter--;
if (panicCounter <= 0) { if (panicCounter <= 0) {
ERROR_LOG(COMMON, "CreateFullPath: directory stracture too deep"); ERROR_LOG(COMMON, "CreateFullPath: directory structure too deep");
return false; return false;
} }
} }

View File

@ -101,10 +101,7 @@ CEXIMemoryCard::CEXIMemoryCard(const std::string& _rName, const std::string& _rF
} }
// Flush memory card contents to disc
//////////////////////////////////////////////////////////////////////////////////////////
// Create new memory card
// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
void CEXIMemoryCard::Flush(bool exiting) void CEXIMemoryCard::Flush(bool exiting)
{ {
FILE* pFile = NULL; FILE* pFile = NULL;
@ -115,7 +112,7 @@ void CEXIMemoryCard::Flush(bool exiting)
std::string dir; std::string dir;
SplitPath(m_strFilename, &dir, 0, 0); SplitPath(m_strFilename, &dir, 0, 0);
if(!File::IsDirectory(dir.c_str())) if(!File::IsDirectory(dir.c_str()))
File::CreateDir(dir.c_str()); File::CreateFullPath(dir.c_str());
pFile = fopen(m_strFilename.c_str(), "wb"); pFile = fopen(m_strFilename.c_str(), "wb");
} }
@ -134,8 +131,6 @@ void CEXIMemoryCard::Flush(bool exiting)
Core::DisplayMessage(StringFromFormat("Wrote memory card %c contents to %s", card_index ? 'B' : 'A', m_strFilename.c_str()).c_str(), 4000); Core::DisplayMessage(StringFromFormat("Wrote memory card %c contents to %s", card_index ? 'B' : 'A', m_strFilename.c_str()).c_str(), 4000);
} }
} }
//////////////////////////////////////
CEXIMemoryCard::~CEXIMemoryCard() CEXIMemoryCard::~CEXIMemoryCard()
{ {

View File

@ -68,6 +68,7 @@
OutputFile="../../Binary/Win32/$(ProjectName)D.exe" OutputFile="../../Binary/Win32/$(ProjectName)D.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
SubSystem="1" SubSystem="1"
TargetMachine="1" TargetMachine="1"
/> />
@ -143,6 +144,7 @@
OutputFile="../../Binary/x64/$(ProjectName)D.exe" OutputFile="../../Binary/x64/$(ProjectName)D.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
SubSystem="1" SubSystem="1"
TargetMachine="17" TargetMachine="17"
/> />
@ -218,6 +220,7 @@
OutputFile="../../Binary/Win32/$(ProjectName).exe" OutputFile="../../Binary/Win32/$(ProjectName).exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
@ -296,6 +299,7 @@
OutputFile="../../Binary/x64/$(ProjectName).exe" OutputFile="../../Binary/x64/$(ProjectName).exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"