Merge remote-tracking branch 'origin/master' into d3d12

This commit is contained in:
gibbed 2019-07-18 18:39:17 -05:00
commit 23c9341642
3 changed files with 6 additions and 4 deletions

View File

@ -99,7 +99,7 @@ std::string CanonicalizePath(const std::string& original_path) {
bool CreateParentFolder(const std::wstring& path) {
auto fixed_path = xe::fix_path_separators(path, xe::kWPathSeparator);
auto base_path = xe::find_base_path(fixed_path, xe::kWPathSeparator);
if (!PathExists(base_path)) {
if (!base_path.empty() && !PathExists(base_path)) {
return CreateFolder(base_path);
} else {
return true;

View File

@ -262,7 +262,7 @@ std::wstring find_name_from_path(const std::wstring& path, wchar_t sep) {
std::string find_base_path(const std::string& path, char sep) {
auto last_slash = path.find_last_of(sep);
if (last_slash == std::string::npos) {
return path;
return "";
} else if (last_slash == path.length() - 1) {
auto prev_slash = path.find_last_of(sep, last_slash - 1);
if (prev_slash == std::string::npos) {
@ -278,7 +278,7 @@ std::string find_base_path(const std::string& path, char sep) {
std::wstring find_base_path(const std::wstring& path, wchar_t sep) {
auto last_slash = path.find_last_of(sep);
if (last_slash == std::wstring::npos) {
return path;
return L"";
} else if (last_slash == path.length() - 1) {
auto prev_slash = path.find_last_of(sep, last_slash - 1);
if (prev_slash == std::wstring::npos) {

View File

@ -32,7 +32,9 @@ bool TraceWriter::Open(const std::wstring& path, uint32_t title_id) {
auto canonical_path = xe::to_absolute_path(path);
auto base_path = xe::find_base_path(canonical_path);
xe::filesystem::CreateFolder(base_path);
if (!base_path.empty()) {
xe::filesystem::CreateFolder(base_path);
}
file_ = xe::filesystem::OpenFile(canonical_path, "wb");
if (!file_) {