Linux: Fix FileChooser ignoring the initial directory with zenity#1678
Open
emezeske wants to merge 1 commit into
Open
Linux: Fix FileChooser ignoring the initial directory with zenity#1678emezeske wants to merge 1 commit into
emezeske wants to merge 1 commit into
Conversation
Collaborator
|
This pull request has been mentioned on The JUCE Forum. There might be relevant details there: https://forum.juce.com/t/pr-linux-fix-filechooser-ignoring-the-initial-directory-w-zenity/69088/1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Linux, a
FileChooserconstructed with an initial directory opens in$HOMEinstead of that directory when the zenity backend is used (the default on non-KDE sessions). The kdialog backend is unaffected.Cause
addZenityArgs()changes the working directory to the target folder and then passes onlystartingFile.getFileName(), a bare, relative basename, as--filename. zenity/GTK does not resolve a relative--filename, so it is ignored and the dialog falls back to$HOME. When the starting location is a directory,getFileName()returns the directory's own leaf name, which is never what's intended.Fix
Pass an absolute path in
--filename. For a directory, append a trailing separator so zenity opens inside the folder rather than pre-selecting it within its parent. This mirrors what the kdialog branch already does (it passes a full path).Testing
Verified on Wayland with zenity 4.2.1: open, save, and import dialogs now start in the requested directory (presets, environments, recording-output folders) instead of
$HOME.