aferrero2707 / PhotoFlow

A fully non-destructive photo retouching program providing a complete layer-based workflow including RAW image development.
http://aferrero2707.github.io/PhotoFlow
GNU General Public License v3.0
309 stars 36 forks source link

AppImage in batch mode doesn't work #149

Open phweyland opened 7 years ago

phweyland commented 7 years ago

Batch file. This batch file works when refers to normal PF install, but doesn't when refers to AppImage:

#!/bin/bash
default=$HOME/.photoflow/presets/default.pfp
# photoflow=/usr/bin/photoflow
photoflow=$HOME/Downloads/PhotoFlow.AppImage
for i in $1/*.NEF
do $photoflow --batch $i $default $1/PFf/%name%.jpg
done

It stops there:

/tmp/.mount_PdbCCx/usr/bin/photoflow.real --batch ./test.NEF /home/weyland/.photoflow/presets/default.pfp ./PFf/%name%.jpg
exePath: /tmp/.mount_PdbCCx/usr/bin
dataPath: /tmp/.mount_PdbCCx/usr/bin/../share/photoflow/
localePath: /tmp/.mount_PdbCCx/usr/bin/../share/locale
memory: high-water mark 0 bytes
aferrero2707 commented 7 years ago

I will lokk into this in few days. Thanks for reporting!

probonopd commented 7 years ago

Please let me know if I can help here.

aferrero2707 commented 7 years ago

@probonopd Thanks! I'm running some checks right now, as I suspect that the problem is on the photoflow side... I'll get back to you in needed.

aferrero2707 commented 7 years ago

@phweyland could you try passing an absolute path to your script?

The current directory is changed by the AppImage startup script, so relative paths do not work properly...

It would be nice to find a fix for this!

probonopd commented 7 years ago

If everything inside the AppImage is relocateable (i.e., doesn't rely on binary-patched absolute paths), then you could replace AppRun by your own launcher, and not have it chdir() to the AppDir. Let me know if this is unclear.

phweyland commented 7 years ago

Yes, with absolute path the script works fine.

aferrero2707 commented 7 years ago

@probonopd

If everything inside the AppImage is relocateable (i.e., doesn't rely on binary-patched absolute paths), then you could replace AppRun by your own launcher, and not have it chdir() to the AppDir. Let me know if this is unclear.

This is perfectly clear, however I am not sure if it is applicable in this case. There are some configuration files and plug-in libraries (for example the gdk-pixbuf loaders) that rely on the patched paths and therefore require the chdir()... I need to think a bot more about the problem.

probonopd commented 7 years ago

In this case, I think it would be possible to patch the location that is used for the file open/save dialog. AppImage exports $OWD (original working directory) to facilitate this.

https://github.com/AppImage/AppImageKit/blob/e6a37a2db1a508d54c54f2127287328ea4e920ae/runtime.c#L497-L501

aferrero2707 commented 7 years ago

That's a good suggestion, thanks! The problem actually concerns only file names passed from the command line, as the files selected via the GUI should automatically have an absolute path.

I will add a check for the existence of the OWD variable, and prepend its value to file names that are given with relative paths.

Thanks!

jeroenpeters1986 commented 6 years ago

Hi, I just used the latest linear_gamma AppImage (https://github.com/aferrero2707/PhotoFlow/releases/download/unstable/PhotoFlow-20171124_1353-git-linear_gamma-cc33c6fa5665d7bf4167664a8877208c0a2887b2.glibc2.17-dbg.glibc2.17-x86_64.AppImage).

This still seems to be present.

What I also have done is setting the AppImage and the image file in the same directory, but it still ends with: PhotoFlow::run_batch(): input file not found: "9159.ARW" memory: high-water mark 0 bytes

Edit: I can continue, of course, by giving the full path :-)