[Base] Fix find_base_path returning original string with no separator is found.

This commit is contained in:
gibbed 2019-07-18 18:31:21 -05:00
parent 0d3039f5ba
commit 706c810a3a
1 changed files with 2 additions and 2 deletions

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) {