mirror of https://github.com/odrling/Aegisub
Don't assume a max length in fs::ShortName
This commit is contained in:
parent
d96fc1f70d
commit
1734f00d8a
|
@ -35,7 +35,11 @@ namespace bfs = boost::filesystem;
|
|||
|
||||
namespace agi { namespace fs {
|
||||
std::string ShortName(path const& p) {
|
||||
std::wstring out(MAX_PATH + 1, 0);
|
||||
DWORD length = GetShortPathName(p.c_str(), NULL, 0);
|
||||
if (!length)
|
||||
return p.string();
|
||||
|
||||
std::wstring out(length, 0);
|
||||
DWORD len = GetShortPathName(p.c_str(), &out[0], out.size());
|
||||
if (!len)
|
||||
return p.string();
|
||||
|
|
Loading…
Reference in New Issue