Skip to content

Commit edd7a37

Browse files
committed
get the full path name
1 parent 1e21a20 commit edd7a37

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

PathUtils.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// sktoolslib - common files for SK tools
22

3-
// Copyright (C) 2013-2015, 2017, 2020-2022 - Stefan Kueng
3+
// Copyright (C) 2013-2015, 2017, 2020-2023 - Stefan Kueng
44

55
// This program is free software; you can redistribute it and/or
66
// modify it under the terms of the GNU General Public License
@@ -121,6 +121,17 @@ std::wstring CPathUtils::GetLongPathname(const std::wstring& path)
121121
}
122122
if (ret == 0)
123123
return path;
124+
if (sRet.starts_with('\\'))
125+
{
126+
ret = GetFullPathName(sRet.c_str(), 0, nullptr, nullptr);
127+
if (ret)
128+
{
129+
auto fullPath = std::make_unique<wchar_t[]>(ret + 2);
130+
ret = GetFullPathName(sRet.c_str(), ret + 1, fullPath.get(), nullptr);
131+
if (ret)
132+
sRet = std::wstring(fullPath.get(), ret);
133+
}
134+
}
124135
return sRet;
125136
}
126137

0 commit comments

Comments
 (0)