summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/FileUtil.cpp14
-rw-r--r--Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp9
2 files changed, 11 insertions, 12 deletions
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp
index 63464ae256..11fd035ad9 100644
--- a/Source/Core/Common/Src/FileUtil.cpp
+++ b/Source/Core/Common/Src/FileUtil.cpp
@@ -172,9 +172,13 @@ bool CreateFullPath(const char *fullPath)
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) {
- // Find next sub path, support both \ and / directory separators
+ // Find next sub path
position = strchr(position, DIR_SEP_CHR);
// we're done, yay!
@@ -184,9 +188,9 @@ bool CreateFullPath(const char *fullPath)
position++;
// Create next sub path
- int sLen = (int)(position - fullPath);
+ int sLen = (int)(position - strFullPath.c_str());
if (sLen > 0) {
- char *subPath = strndup(fullPath, sLen);
+ char *subPath = strndup(strFullPath.c_str(), sLen);
if (!File::IsDirectory(subPath)) {
File::CreateDir(subPath);
}
@@ -196,7 +200,7 @@ bool CreateFullPath(const char *fullPath)
// A safety check
panicCounter--;
if (panicCounter <= 0) {
- ERROR_LOG(COMMON, "CreateFullPath: directory stracture too deep");
+ ERROR_LOG(COMMON, "CreateFullPath: directory structure too deep");
return false;
}
}
diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp
index abc890f5b1..c9c097ef7b 100644
--- a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp
+++ b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp
@@ -101,10 +101,7 @@ CEXIMemoryCard::CEXIMemoryCard(const std::string& _rName, const std::string& _rF
}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// Create new memory card
-// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
+// Flush memory card contents to disc
void CEXIMemoryCard::Flush(bool exiting)
{
FILE* pFile = NULL;
@@ -115,7 +112,7 @@ void CEXIMemoryCard::Flush(bool exiting)
std::string dir;
SplitPath(m_strFilename, &dir, 0, 0);
if(!File::IsDirectory(dir.c_str()))
- File::CreateDir(dir.c_str());
+ File::CreateFullPath(dir.c_str());
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);
}
}
-//////////////////////////////////////
-
CEXIMemoryCard::~CEXIMemoryCard()
{