[Solved] Change of queue output directory not taken fully into account if no %f

bug
(Pietro Dolcini) #1

First of all, thank you very much for this wonderful piece of software !
(I don’t want to sound like I’m complaining :slight_smile: )

I found an unexpected behavior when changing the output directory in the Queue tab.
I use a folder structure like this :

photos folder/
photos folder/photo_1.jpg
photos folder/raw/
photos folder/raw/photo_1.arw (Sony raw file)

Before when writing the developed pictures, I used to create a “converted” subfolder in the raw directory and then move the photos by hand. In this case the output directory was :
%p1/converted/%f

Then checking the tooltip on the output directory I realized that I could ask Rawtherapee to automatically put my output JPG directly in the correct directory one level higher with the %p2 variable.
The problem was that I did not pay attention and just used %p2 without %f.
In this case no error message is displayed and pictures end up in %p2/converted folder.
Now I changed to %p2/%f and pictures end up in the correct folder without the added “converted”.

I hope I’m clear enough.

0 Likes

(Morgan Hardwood) #2

Confirmed:

  1. Copy a raw file to /tmp/photos/raw/pippi.arw
  2. Set the queue template to %p2/%f and the file gets saved to /tmp/photos/pippi.jpg, all good.
  3. Set it to %p2 only, without the %f, and the file gets saved to /tmp/photos/photos.jpg. Likewise, if you set it to %p3 only, you get /tmp/tmp.jpg

Though it may seem odd, it is consistent. The filename used while exporting does not need to resemble the filename of the input image.

0 Likes

(Pietro Dolcini) #3

Dear Morgan,

the behavior you explain is indeed odd, but is not exactly the issue I faced.

I took some screenshots to be more clear :

  1. initial setup similar to your case but with 2 raw files
    Screenshot_2019-04-02_21-24-23

  2. first export in %p1/convert/%f
    Screenshot_2019-04-02_21-25-22

  3. expected result in the output directory
    Screenshot_2019-04-02_21-25-59

  4. back in rawtherapee change the output to %p2 only
    Screenshot_2019-04-02_21-26-26

  5. the surprising result is a directory called “convert” in the %p2 path containing the JPG files
    Screenshot_2019-04-02_21-26-58

0 Likes

(Flössie) #4

Yet another OOB access:

diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc
index 9792522c7..2aa94c389 100644
--- a/rtgui/batchqueue.cc
+++ b/rtgui/batchqueue.cc
@@ -860,9 +860,9 @@ Glib::ustring BatchQueue::calcAutoFileNameBase (const Glib::ustring& origFileNam
     Glib::ustring path = "";
 
     if (options.saveUsePathTemplate) {
-        int ix = 0;
+        unsigned int ix = 0;
 
-        while (options.savePathTemplate[ix] != 0) {
+        while (ix < options.savePathTemplate.size()) {
             if (options.savePathTemplate[ix] == '%') {
                 ix++;
 

HTH,
Flössie

1 Like

(Morgan Hardwood) #5

@floessie will you commit this fix, or should I?

0 Likes

(Flössie) #6

You can. I’m busy ATM. Thanks!

0 Likes

(Morgan Hardwood) #7

I can’t reproduce @Pietro_Dolcini’s issue where /tmp/photos/convert/ is magically created when using template %p2, so I noticed no difference with the patch on my end.
Patch committed to dev. @Pietro_Dolcini if you compile yourself, then you can help verify that it’s fixed.

0 Likes

(Morgan Hardwood) #8

The commit is 5.5-283-g977af213b, branch dev.

0 Likes

(Pietro Dolcini) #9

Thanks !
Now compiling, I’ll let you know the result this evening.

0 Likes

(Pietro Dolcini) #10

Hello,

just finished testing.

Now with the previous sequence I get as a result two pictures calles photos.jpg and photos-1.jpg.

In Rawtherapy interface the place where I should write %p2/%f is called “output directory” not “output file names” or maybe simply “output name” which makes it a little surprising that changes the name of the files. Maybe changing the name would avoid other users to make the same mistake as me.

Thank you very much to take the time to make the correction.

0 Likes

(Morgan Hardwood) #11

Agreed, and there were some other issues.
Fixed in 5.5-286-g5bddcb45d.

Thank you for reporting.

1 Like