Always spilt on '\' and '/'

This commit is contained in:
Sam Smith 2018-08-13 17:17:33 -04:00
parent 84963a5511
commit bf784289d2

View File

@ -168,12 +168,8 @@ bool VerifyDirectoryExists(const string& path) {
// directories listed in |filename|. // directories listed in |filename|.
bool TryCreateParentDirectory(const string& prefix, const string& filename) { bool TryCreateParentDirectory(const string& prefix, const string& filename) {
// Recursively create parent directories to the output file. // Recursively create parent directories to the output file.
#if defined(_WIN32) // On Windows, both '/' and '\' are valid path separators.
// on Windows, both '/' and '\' are valid path separators
std::vector<string> parts = Split(filename, "/\\", true); std::vector<string> parts = Split(filename, "/\\", true);
#else
std::vector<string> parts = Split(filename, "/", true);
#endif
string path_so_far = prefix; string path_so_far = prefix;
for (int i = 0; i < parts.size() - 1; i++) { for (int i = 0; i < parts.size() - 1; i++) {
path_so_far += parts[i]; path_so_far += parts[i];