Skip to content

Commit

Permalink
Fixed -flist handling for filenames with spaces (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn authored Oct 6, 2023
1 parent c0253c9 commit 116987f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions XWBTool/xwbtool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,10 +953,10 @@ namespace
std::list<SConversion> flist;
std::set<std::wstring> excludes;

auto fname = std::make_unique<wchar_t[]>(32768);
for (;;)
{
inFile >> fname.get();
std::wstring fname;
std::getline(inFile, fname);
if (!inFile)
break;

Expand All @@ -968,13 +968,13 @@ namespace
{
if (flist.empty())
{
wprintf(L"WARNING: Ignoring the line '%ls' in -flist\n", fname.get());
wprintf(L"WARNING: Ignoring the line '%ls' in -flist\n", fname.c_str());
}
else
{
std::filesystem::path path(fname.get() + 1);
std::filesystem::path path(fname.c_str() + 1);
auto& npath = path.make_preferred();
if (wcspbrk(fname.get(), L"?*") != nullptr)
if (wcspbrk(fname.c_str(), L"?*") != nullptr)
{
std::list<SConversion> removeFiles;
SearchForFiles(npath, removeFiles, false);
Expand All @@ -994,20 +994,18 @@ namespace
}
}
}
else if (wcspbrk(fname.get(), L"?*") != nullptr)
else if (wcspbrk(fname.c_str(), L"?*") != nullptr)
{
std::filesystem::path path(fname.get());
std::filesystem::path path(fname.c_str());
SearchForFiles(path.make_preferred(), flist, false);
}
else
{
SConversion conv = {};
std::filesystem::path path(fname.get());
std::filesystem::path path(fname.c_str());
conv.szSrc = path.make_preferred().native();
flist.push_back(conv);
}

inFile.ignore(1000, '\n');
}

inFile.close();
Expand Down

0 comments on commit 116987f

Please sign in to comment.