Fix home directory expansion in Windows

pull/3/head
Hleb Valoshka 2019-10-08 22:59:08 +03:00
parent 7fd01f38b0
commit 6e44de22f1
1 changed files with 8 additions and 2 deletions

View File

@ -92,8 +92,14 @@ fs::path PathExp(const fs::path& filename)
{ {
#ifdef _WIN32 #ifdef _WIN32
auto str = filename.native(); auto str = filename.native();
if (str[0] == '~' && (str[1] == '\\' || str[1] == '/')) if (str[0] == '~')
return homeDir() / str.substr(1); {
if (str.size() == 1)
return homeDir();
if (str[1] == '\\' || str[1] == '/')
return homeDir() / str.substr(2);
}
return filename; return filename;
#else #else
wordexp_t result; wordexp_t result;