Append default suffix when saving/exporting with a single filter#139
Append default suffix when saving/exporting with a single filter#139denisfalqueto wants to merge 1 commit into
Conversation
…le filter Some Linux native/portal file dialogs don't auto-append the file extension when the user doesn't type one. When the caller offers a single filter (e.g. exporting to PDF), request a defaultSuffix from the dialog so the returned path always has the expected extension. This is skipped when more than one filter is offered (e.g. "Save As" with the experimental uncompressed-folder option), since a single global default suffix would be applied regardless of which filter the user actually picked. Resolves: musescore/MuseScore#33559 Resolves: musescore/MuseScore#33341
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change modifies the Linux implementation of the internal 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ainst file dialog quirks Two independent fixes for PDF export failing/crashing on Linux: - src/app/main.cpp: only force QT_QPA_PLATFORMTHEME=gtk3 when the user hasn't already set it. gtk3 was forced unconditionally to fix keyboard input in the legacy Qt file dialog (musescore#13113), but this also silently overrode any theme the user configured (e.g. "xdgdesktopportal" for proper portal/sandboxed dialog support), which is a likely contributor to file dialogs not respecting the user's desktop environment. The default (gtk3) is unchanged for users who don't set this variable, so musescore#13113 is not reintroduced. QT_QPA_PLATFORM=xcb is left untouched, since it fixes unrelated Wayland issues (VST crashes musescore#28446, panel docking musescore#28352). - src/project/internal/exportprojectscenario.cpp: after the file dialog returns a save path, force the expected export suffix if the path doesn't already have one of the format's known suffixes. On some Linux native/portal dialogs the extension isn't auto-appended when the user doesn't type one, which previously left exportScores() unable to find a writer for the path, causing the export to silently fail. A companion fix in muse_framework (musescore/muse_framework#139) makes the underlying file dialog request a default suffix directly, which addresses the same root cause at the source for the single-format case; this commit adds a safety net that's independent of dialog backend. Resolves: musescore#33341 Resolves: musescore#33559
Summary
On some Linux desktop environments, the native/portal file dialog used for
saving and exporting doesn't auto-append the file extension when the user
doesn't type one. This leaves the caller (e.g. PDF export in the main
MuseScore repo) unable to pick the correct writer for the returned path,
causing exports to silently fail.
makeSelectFileQuery()(interactive.cpp), when opening aSaveFiledialog, request a
defaultSuffixfrom the dialog derived from thesuggested
currentpath's own suffix.callers (e.g. "Save As" for a MuseScore project) offer two filters at
once — the normal
*.msczformat and an experimental uncompressed-folderoption — and a dialog-wide default suffix would be applied regardless of
which filter the user actually selected, silently defeating the
alternate option. That ambiguous case is left untouched.
Companion PR
This is a companion fix to a related PR in
musescore/MuseScore(
src/app/main.cppandsrc/project/internal/exportprojectscenario.cpp),which adds a safety net that enforces the correct suffix after the dialog
returns, regardless of dialog backend.
Testing
Verified with a full local Debug build of MuseScore Studio (main repo,
pointing at this branch) on KDE Plasma Wayland:
.pdffile..pdfexplicitly still works, without aduplicated suffix.
confirm) verified unaffected — this was a deliberate regression check,
since a past issue (#13113) was caused by a different, broken Linux file
dialog swallowing keyboard input.
Disclaimer
This change was implemented with the assistance of Claude Code (Anthropic),
which performed the code changes, the build, and the testing steps
described above. A human reviewed and validated the entire process step by
step, and endorses the final result.