Flatpak: bypass XDG portal for .tum open dialog
Native file dialog routes through the XDG document portal, which exposes only the selected file at /run/user/UID/doc/... — siblings (param.yaml, .py) are unreachable. Force Qt's non-native dialog in Flatpak so it walks the real filesystem via --filesystem=home and returns a usable path.
This commit is contained in:
@@ -212,8 +212,17 @@ class TestFileManager:
|
||||
d = ""
|
||||
if w.testFile is not None:
|
||||
d = os.path.dirname(w.testFile)
|
||||
# In Flatpak the native dialog goes through the XDG document portal,
|
||||
# which returns /run/user/UID/doc/.../test.tum and only exposes the
|
||||
# selected file — sibling files (param.yaml, .py, etc.) are unreachable.
|
||||
# Force Qt's own dialog, which walks the real filesystem mounted via
|
||||
# --filesystem=home and returns a regular path with sibling access.
|
||||
options = QFileDialog.Options()
|
||||
if os.path.isfile("/.flatpak-info"):
|
||||
options |= QFileDialog.Option.DontUseNativeDialog
|
||||
file_name, _ = QFileDialog.getOpenFileName(
|
||||
w, "Open the test file", d, "testium file (*.tum);;All Files (*)"
|
||||
w, "Open the test file", d,
|
||||
"testium file (*.tum);;All Files (*)", options=options
|
||||
)
|
||||
if file_name:
|
||||
self.reload(file_name)
|
||||
|
||||
Reference in New Issue
Block a user