darktable-cli on windows doesn't handle backslash in export file path correctly
It looks like darktable-cli on windows doesn't encode/handle the export file path correctly if it contains backslashes.
This command
darktable-cli C:\Users\user\AppData\Local\Temp\tmpb_m6bo5r\images\_DSC9669.dng C:\Users\user\AppData\Local\Temp\tmpb_m6bo5r\_DSC9669.dng.png --width 1000 --height 1000 --icc-type ADOBERGB --style-overwrite --core --configdir C:\Users\user\AppData\Local\Temp\tmpb_m6bo5r\conf --library :memory: --conf plugins/darkroom/chromatic-adaptation=modern --conf plugins/darkroom/sharpen/auto_apply=FALSE --conf plugins/darkroom/workflow=none --conf opencl=FALSE
gives this error
[imageio_storage_disk] could not export to file: 'C:UsersuserAppDataLocalTemptmpb_m6bo5r_DSC9669.dng.png'!
Apparently the given export path "C:\Users\user\AppData\Local\Temp\tmpb_m6bo5r\_DSC9669.dng.png" becomes "C:UsersuserAppDataLocalTemptmpb_m6bo5r_DSC9669.dng.png" without the backslashes. The resulting path is invalid and the export fails.
The export works correctly when I use double backslashes:
darktable-cli C:\Users\user\AppData\Local\Temp\tmpb_m6bo5r\images\_DSC9669.dng C:\\Users\\user\\AppData\\Local\\Temp\\tmpb_m6bo5r\\_DSC9669.dng.png --width 1000 --height 1000 --icc-type ADOBERGB --style-overwrite --core --configdir C:\Users\user\AppData\Local\Temp\tmpb_m6bo5r\conf --library :memory: --conf plugins/darkroom/chromatic-adaptation=modern --conf plugins/darkroom/sharpen/auto_apply=FALSE --conf plugins/darkroom/workflow=none --conf opencl=FALSE
All other used parameters like input file path or configdir work fine with single backslashes.
@Mark-64: I remember you work on (or answer) on such issue. If you have time to take a look (I don't use Windows since a time on my side).
I do not use darktable-cli, but I will look into this when I have time
This issue did not get any activity in the past 60 days and will be closed in 365 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.
I can confirm this problem. I want to try the darktable_lut_generator. But the paths are messed up by darktable-cli, so the output files are not generated for further processing:
converting image IMG_3170.TIF C:\Program Files\darktable\bin\darktable-cli.exe C:\Users\MyName\AppData\Local\Temp\tmpdz8tmcp0\images\IMG_3170.TIF C:\Users\MyName\AppData\Local\Temp\tmpdz8tmcp0\IMG_3170.TIF.png --width 1000 --height 1000 --icc-type ADOBERGB --style-overwrite --core --configdir C:\Users\MyName\AppData\Local\Temp\tmpdz8tmcp0\conf --library :memory: --conf plugins/darkroom/chromatic-adaptation=modern --conf plugins/darkroom/sharpen/auto_apply=FALSE --conf plugins/darkroom/workflow=none --conf opencl=FALSE
(darktable-cli.exe:7004): Gtk-WARNING **: 19:47:53.843: gtk_disable_setlocale() must be called before gtk_init() [export_job] exported to `C:UsersMyNameAppDataLocalTemptmpdz8tmcp0IMG_3170.TIF.png'
This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.
I'd like to give this a bump, I also had a look into the code. I think I've found the reason why export file path is handled differently than the input file path: for the export file path g_strdup is used, but not for the others, see src/cli/main.c, lines 424ff:
if(file_counter == 0)
input_filename = arg[k];
else if(file_counter == 1)
xmp_filename = arg[k];
else if(file_counter == 2)
{
output_filename = g_strdup(arg[k]);
}
I don't have a build environment on windows to test if this is the issue, or if removing g_strdup would break other things.
As a workaround you could use \\ in place of \.
This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.