Skip to content

Commit 8173bf9

Browse files
yskim1501ryanlai2
authored andcommitted
read jpeg. print out error if unsupported file extension (#190)
1 parent e34ff81 commit 8173bf9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Tools/WinMLRunner/src/CommandLineArgs.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,21 @@ CommandLineArgs::CommandLineArgs(const std::vector<std::wstring>& args)
301301

302302
if (!m_inputData.empty())
303303
{
304-
if (m_inputData.find(L".png") != std::string::npos || m_inputData.find(L".jpg") != std::string::npos)
304+
std::transform(m_inputData.begin(), m_inputData.end(), m_inputData.begin(), ::towlower);
305+
if (m_inputData.find(L".png") != std::string::npos || m_inputData.find(L".jpg") != std::string::npos ||
306+
m_inputData.find(L".jpeg") != std::string::npos)
305307
{
306308
m_imagePath = m_inputData;
307309
}
308-
if (m_inputData.find(L".csv") != std::string::npos)
310+
else if (m_inputData.find(L".csv") != std::string::npos)
309311
{
310-
m_csvData = m_inputData;
312+
m_csvData = m_inputData;
313+
}
314+
else
315+
{
316+
std::wstring msg = L"unknown input type ";
317+
msg += m_inputData;
318+
throw hresult_invalid_argument(msg.c_str());
311319
}
312320
}
313321
CheckForInvalidArguments();

0 commit comments

Comments
 (0)