@@ -423,7 +423,7 @@ namespace
423
423
{
424
424
PrintLogo (false , g_ToolName, g_Description);
425
425
426
- static const wchar_t * const s_usage =
426
+ static const wchar_t * const s_usage =
427
427
L" Usage: texdiag <command> <options> [--] <files>\n "
428
428
L" \n "
429
429
L" info Output image metadata\n "
@@ -446,7 +446,7 @@ namespace
446
446
L" \n "
447
447
L" (diff only)\n "
448
448
L" -f <format> format\n "
449
- L" -o <filename> output filename \n "
449
+ L" -o <path/ filename> output filename for diff; output path for dumpdds \n "
450
450
L" -l force output filename to lower case\n "
451
451
L" -y overwrite existing output file (if any)\n "
452
452
L" -c <hex-RGB> highlight difference color (defaults to off)\n "
@@ -3173,17 +3173,20 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
3173
3173
break ;
3174
3174
3175
3175
case OPT_OUTPUTFILE:
3176
- if (dwCommand != CMD_DIFF)
3176
+ if (dwCommand != CMD_DIFF && dwCommand != CMD_DUMPDDS )
3177
3177
{
3178
- wprintf (L" -o only valid for use with diff command \n " );
3178
+ wprintf (L" -o only valid for use with diff or dumpdds commands \n " );
3179
3179
return 1 ;
3180
3180
}
3181
3181
else
3182
3182
{
3183
3183
std::filesystem::path path (pValue);
3184
3184
outputFile = path.make_preferred ().native ();
3185
3185
3186
- fileType = LookupByName (path.extension ().c_str (), g_pExtFileTypes);
3186
+ if (dwCommand == CMD_DIFF)
3187
+ {
3188
+ fileType = LookupByName (path.extension ().c_str (), g_pExtFileTypes);
3189
+ }
3187
3190
}
3188
3191
break ;
3189
3192
@@ -3656,6 +3659,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
3656
3659
3657
3660
auto const ext = LookupByValue (fileType, g_pDumpFileTypes);
3658
3661
3662
+ std::filesystem::path basePath (outputFile);
3663
+
3659
3664
if (info.depth > 1 )
3660
3665
{
3661
3666
wprintf (L" Writing by mip (%3zu) and slice (%3zu)..." , info.mipLevels , info.depth );
@@ -3684,10 +3689,11 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
3684
3689
swprintf_s (subFname, L" %ls_slice%03zu" , curpath.stem ().c_str (), slice);
3685
3690
}
3686
3691
3687
- outputFile.assign (subFname);
3688
- outputFile.append (ext);
3692
+ std::filesystem::path output (basePath);
3693
+ output.append (subFname);
3694
+ output.replace_extension (ext);
3689
3695
3690
- hr = SaveImage (img, outputFile .c_str (), fileType);
3696
+ hr = SaveImage (img, output .c_str (), fileType);
3691
3697
if (FAILED (hr))
3692
3698
{
3693
3699
wprintf (L" FAILED (%08X%ls)\n " , static_cast <unsigned int >(hr), GetErrorDesc (hr));
@@ -3728,10 +3734,11 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
3728
3734
swprintf_s (subFname, L" %ls_item%03zu" , curpath.stem ().c_str (), item);
3729
3735
}
3730
3736
3731
- outputFile.assign (subFname);
3732
- outputFile.append (ext);
3737
+ std::filesystem::path output (basePath);
3738
+ output.append (subFname);
3739
+ output.replace_extension (ext);
3733
3740
3734
- hr = SaveImage (img, outputFile .c_str (), fileType);
3741
+ hr = SaveImage (img, output .c_str (), fileType);
3735
3742
if (FAILED (hr))
3736
3743
{
3737
3744
wprintf (L" FAILED (%08X%ls)\n " , static_cast <unsigned int >(hr), GetErrorDesc (hr));
0 commit comments