Skip to content

fix: fix current working directory for AppImages - #3778

Open
rodolforg wants to merge 1 commit into
synfig:masterfrom
rodolforg:fix-appimage-cwd
Open

rodolforg wants to merge 1 commit into
synfig:masterfrom
rodolforg:fix-appimage-cwd

Conversation

@rodolforg

Copy link
Copy Markdown
Contributor

It should now allow to launch the AppImage with a SIF file as argument.

$ synfig.appimage myanimation.sifz

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity · 0 duplication

Metric Results
Complexity 5
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates get_current_working_directory() in synfig-core/src/synfig/os.cpp to support the OWD environment variable for AppImages and refactors the existing PWD check. The review feedback correctly points out that the function must return an absolute path, and suggests verifying that the paths resolved from OWD and PWD are absolute using path.is_absolute() to prevent breaking pathname resolutions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread synfig-core/src/synfig/os.cpp
@rodolforg

Copy link
Copy Markdown
Contributor Author

Oh, an actual good code review... I thought about the issue but stupidly couldn't get a solution. XD

It should now allow to launch the AppImage with a SIF file as argument.

```sh
$ synfig.appimage myanimation.sifz
```
@BobSynfig

Copy link
Copy Markdown
Collaborator

Normally under Linux, we should use synfig.appimage ./myanimation.sifz to open a file from the current directory.

Also, as appimage requires the FQN, and ./myanimation.sifz can't work as ./ looks inside the same directory as synfigstudio, i.e. /tmp/.mount_Synfigxxxxxx/usr/

Working solutions:

  • synfig.appimage "$(pwd)/myanimation.sifz"
  • synfig.appimage "$PWD/myanimation.sifz"
  • synfig.appimage $(realpath myanimation.sifz)

And of course the same system to call synfig instead of synfigstudio

  • synfig.appimage --appimage-exec synfig "$PWD/myanimation.sifz" (v1)
  • synfig.AppImage --exec synfig "$PWD/myanimation.sifz" (v2)

@rodolforg

Copy link
Copy Markdown
Contributor Author

@BobSynfig So my PR doesn't work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants