Skip to content

Commit 116987f

Browse files
authored
Fixed -flist handling for filenames with spaces (#405)
1 parent c0253c9 commit 116987f

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

XWBTool/xwbtool.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -953,10 +953,10 @@ namespace
953953
std::list<SConversion> flist;
954954
std::set<std::wstring> excludes;
955955

956-
auto fname = std::make_unique<wchar_t[]>(32768);
957956
for (;;)
958957
{
959-
inFile >> fname.get();
958+
std::wstring fname;
959+
std::getline(inFile, fname);
960960
if (!inFile)
961961
break;
962962

@@ -968,13 +968,13 @@ namespace
968968
{
969969
if (flist.empty())
970970
{
971-
wprintf(L"WARNING: Ignoring the line '%ls' in -flist\n", fname.get());
971+
wprintf(L"WARNING: Ignoring the line '%ls' in -flist\n", fname.c_str());
972972
}
973973
else
974974
{
975-
std::filesystem::path path(fname.get() + 1);
975+
std::filesystem::path path(fname.c_str() + 1);
976976
auto& npath = path.make_preferred();
977-
if (wcspbrk(fname.get(), L"?*") != nullptr)
977+
if (wcspbrk(fname.c_str(), L"?*") != nullptr)
978978
{
979979
std::list<SConversion> removeFiles;
980980
SearchForFiles(npath, removeFiles, false);
@@ -994,20 +994,18 @@ namespace
994994
}
995995
}
996996
}
997-
else if (wcspbrk(fname.get(), L"?*") != nullptr)
997+
else if (wcspbrk(fname.c_str(), L"?*") != nullptr)
998998
{
999-
std::filesystem::path path(fname.get());
999+
std::filesystem::path path(fname.c_str());
10001000
SearchForFiles(path.make_preferred(), flist, false);
10011001
}
10021002
else
10031003
{
10041004
SConversion conv = {};
1005-
std::filesystem::path path(fname.get());
1005+
std::filesystem::path path(fname.c_str());
10061006
conv.szSrc = path.make_preferred().native();
10071007
flist.push_back(conv);
10081008
}
1009-
1010-
inFile.ignore(1000, '\n');
10111009
}
10121010

10131011
inFile.close();

0 commit comments

Comments
 (0)