mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-21 20:10:05 +00:00
Fixed -flist handling for filenames with spaces (#402)
This commit is contained in:
parent
cb5279f10e
commit
d19b882a55
@ -491,10 +491,10 @@ namespace
|
|||||||
std::list<SConversion> flist;
|
std::list<SConversion> flist;
|
||||||
std::set<std::wstring> excludes;
|
std::set<std::wstring> excludes;
|
||||||
|
|
||||||
auto fname = std::make_unique<wchar_t[]>(32768);
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
inFile >> fname.get();
|
std::wstring fname;
|
||||||
|
std::getline(inFile, fname);
|
||||||
if (!inFile)
|
if (!inFile)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -506,13 +506,13 @@ namespace
|
|||||||
{
|
{
|
||||||
if (flist.empty())
|
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
|
else
|
||||||
{
|
{
|
||||||
std::filesystem::path path(fname.get() + 1);
|
std::filesystem::path path(fname.c_str() + 1);
|
||||||
auto& npath = path.make_preferred();
|
auto& npath = path.make_preferred();
|
||||||
if (wcspbrk(fname.get(), L"?*") != nullptr)
|
if (wcspbrk(fname.c_str(), L"?*") != nullptr)
|
||||||
{
|
{
|
||||||
std::list<SConversion> removeFiles;
|
std::list<SConversion> removeFiles;
|
||||||
SearchForFiles(npath, removeFiles, false);
|
SearchForFiles(npath, removeFiles, false);
|
||||||
@ -532,20 +532,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);
|
SearchForFiles(path.make_preferred(), flist, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SConversion conv = {};
|
SConversion conv = {};
|
||||||
std::filesystem::path path(fname.get());
|
std::filesystem::path path(fname.c_str());
|
||||||
conv.szSrc = path.make_preferred().native();
|
conv.szSrc = path.make_preferred().native();
|
||||||
flist.push_back(conv);
|
flist.push_back(conv);
|
||||||
}
|
}
|
||||||
|
|
||||||
inFile.ignore(1000, '\n');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inFile.close();
|
inFile.close();
|
||||||
|
@ -639,10 +639,10 @@ namespace
|
|||||||
std::list<SConversion> flist;
|
std::list<SConversion> flist;
|
||||||
std::set<std::wstring> excludes;
|
std::set<std::wstring> excludes;
|
||||||
|
|
||||||
auto fname = std::make_unique<wchar_t[]>(32768);
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
inFile >> fname.get();
|
std::wstring fname;
|
||||||
|
std::getline(inFile, fname);
|
||||||
if (!inFile)
|
if (!inFile)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -654,13 +654,13 @@ namespace
|
|||||||
{
|
{
|
||||||
if (flist.empty())
|
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
|
else
|
||||||
{
|
{
|
||||||
std::filesystem::path path(fname.get() + 1);
|
std::filesystem::path path(fname.c_str() + 1);
|
||||||
auto& npath = path.make_preferred();
|
auto& npath = path.make_preferred();
|
||||||
if (wcspbrk(fname.get(), L"?*") != nullptr)
|
if (wcspbrk(fname.c_str(), L"?*") != nullptr)
|
||||||
{
|
{
|
||||||
std::list<SConversion> removeFiles;
|
std::list<SConversion> removeFiles;
|
||||||
SearchForFiles(npath, removeFiles, false, nullptr);
|
SearchForFiles(npath, removeFiles, false, nullptr);
|
||||||
@ -680,20 +680,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, nullptr);
|
SearchForFiles(path.make_preferred(), flist, false, nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SConversion conv = {};
|
SConversion conv = {};
|
||||||
std::filesystem::path path(fname.get());
|
std::filesystem::path path(fname.c_str());
|
||||||
conv.szSrc = path.make_preferred().native();
|
conv.szSrc = path.make_preferred().native();
|
||||||
flist.push_back(conv);
|
flist.push_back(conv);
|
||||||
}
|
}
|
||||||
|
|
||||||
inFile.ignore(1000, '\n');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inFile.close();
|
inFile.close();
|
||||||
|
@ -481,10 +481,10 @@ namespace
|
|||||||
std::list<SConversion> flist;
|
std::list<SConversion> flist;
|
||||||
std::set<std::wstring> excludes;
|
std::set<std::wstring> excludes;
|
||||||
|
|
||||||
auto fname = std::make_unique<wchar_t[]>(32768);
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
inFile >> fname.get();
|
std::wstring fname;
|
||||||
|
std::getline(inFile, fname);
|
||||||
if (!inFile)
|
if (!inFile)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -496,13 +496,13 @@ namespace
|
|||||||
{
|
{
|
||||||
if (flist.empty())
|
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
|
else
|
||||||
{
|
{
|
||||||
std::filesystem::path path(fname.get() + 1);
|
std::filesystem::path path(fname.c_str() + 1);
|
||||||
auto& npath = path.make_preferred();
|
auto& npath = path.make_preferred();
|
||||||
if (wcspbrk(fname.get(), L"?*") != nullptr)
|
if (wcspbrk(fname.c_str(), L"?*") != nullptr)
|
||||||
{
|
{
|
||||||
std::list<SConversion> removeFiles;
|
std::list<SConversion> removeFiles;
|
||||||
SearchForFiles(npath, removeFiles, false);
|
SearchForFiles(npath, removeFiles, false);
|
||||||
@ -522,20 +522,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);
|
SearchForFiles(path.make_preferred(), flist, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SConversion conv = {};
|
SConversion conv = {};
|
||||||
std::filesystem::path path(fname.get());
|
std::filesystem::path path(fname.c_str());
|
||||||
conv.szSrc = path.make_preferred().native();
|
conv.szSrc = path.make_preferred().native();
|
||||||
flist.push_back(conv);
|
flist.push_back(conv);
|
||||||
}
|
}
|
||||||
|
|
||||||
inFile.ignore(1000, '\n');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inFile.close();
|
inFile.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user