darktable icon indicating copy to clipboard operation
darktable copied to clipboard

darktable-cli on windows doesn't handle backslash in export file path correctly

Open DonClemente opened this issue 3 years ago • 8 comments

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.

DonClemente avatar Nov 21 '22 15:11 DonClemente

@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).

Nilvus avatar Nov 22 '22 18:11 Nilvus

I do not use darktable-cli, but I will look into this when I have time

Mark-64 avatar Nov 27 '22 07:11 Mark-64

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.

github-actions[bot] avatar Jan 27 '23 00:01 github-actions[bot]

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'

FlintEastwood avatar Mar 27 '23 18:03 FlintEastwood

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.

github-actions[bot] avatar May 27 '23 00:05 github-actions[bot]

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.

DonClemente avatar Feb 17 '24 09:02 DonClemente

As a workaround you could use \\ in place of \.

wpferguson avatar Feb 17 '24 18:02 wpferguson

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.

github-actions[bot] avatar Apr 19 '24 00:04 github-actions[bot]