summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/FileUtil.cpp
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2009-04-16 17:24:06 +0000
committerShawn Hoffman <godisgovernment@gmail.com>2009-04-16 17:24:06 +0000
commite6dbfb4f24ba011bb6535fa3339710f46f3aa790 (patch)
tree768134383755306e0008911e90bc3bc47e90aa74 /Source/Core/Common/Src/FileUtil.cpp
parent508b32b94f043330fbcf06ae3d7a75ecfd69ff93 (diff)
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
Diffstat (limited to 'Source/Core/Common/Src/FileUtil.cpp')
-rw-r--r--Source/Core/Common/Src/FileUtil.cpp14
1 files changed, 9 insertions, 5 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;
}
}