Skip to content

fix(platform): a folder dialog opens on a folder that exists (#331) - #374

Merged
jub0t merged 1 commit into
jub0t:mainfrom
chiarorosa:fix/pick-folder-missing-start
Oct 16, 2026
Merged

jub0t merged 1 commit into
jub0t:mainfrom
chiarorosa:fix/pick-folder-missing-start

Conversation

@chiarorosa

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #331. On a first run the new-project sheet's default location, <Desktop>/Concat, does not exist yet (default_location() only makes it on iOS), and platform::pick_folder passed it to rfd::FileDialog::set_directory as is. The dialog in the report is GNOME's chooser (Nautilus, behind the xdg portal): its "无法找到 "…/Desktop/Concat"" is Nautilus's Unable to find "%s". Please check the spelling and try again., a string only nautilus.mo carries, and the window then waits on that dialog until GNOME calls it unresponsive.

pick_folder now starts the dialog at the nearest folder of the path that exists, the desktop itself on a first run, and asks for no starting folder when none does (an empty start, as before). Export and Open call pick_folder the same way and get the same.

How to test

cargo test -p concat a_folder_dialog_starts_at_a_folder_that_exists. By hand, on GNOME 47+ with no ~/Desktop/Concat: New project › Location › Select opens on the desktop instead of an error.

What I ran, being on Windows without the native dependencies the whole workspace needs:

  • rustfmt --check (1.93.1, the repo's rustfmt.toml) on platform.rs.
  • The new function and test in a standalone crate: the test fails against the old behaviour (path passed through unchanged) and passes with the fix; cargo clippy --all-targets -- -D warnings is clean; it also fails under two mutations (only start itself checked, is_dir negated).
  • In Docker (Debian/Ubuntu, Xvfb), rfd 0.17.2's pick_folder and GTK 4's chooser both open quietly elsewhere on a missing folder, so it's Nautilus specifically that errors; I could not run Nautilus's portal there, so the dialog in the report itself is not reproduced.

I have not built the concat crate itself, so this relies on CI for the workspace clippy and test.

Checklist

  • cargo fmt --check passes (rustfmt on the changed file)
  • cargo clippy --all-targets -- -D warnings passes (on the change in isolation; workspace left to CI)
  • cargo test passes (the new test in isolation; workspace left to CI)
  • python3 scripts/locales.py run (if UI text changed): no UI text changed
  • New source files have a licence header: no new files

A new project's default location, <Desktop>/Concat, is not made until the
first project is, and pick_folder handed it to the dialog as is. GNOME's
chooser (Nautilus, behind the portal) answers a folder that is not there
with "Unable to find ..." and the window waits on it until GNOME calls it
unresponsive. The dialog now starts at the nearest folder of that path
that exists: the desktop itself, on a first run. Export and Open, which
call pick_folder the same way, get the same.

Signed-off-by: chiarorosa <pablo.chiaro.rosa@gmail.com>
@jub0t
jub0t merged commit c6e0305 into jub0t:main Oct 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error and freeze when creating a new project for the first time

2 participants