Closed Waqar144 closed 1 year ago
So as I mentioned in https://github.com/flathub/org.kde.kate/pull/24#issuecomment-1467779235, I think it would be really great if Kate could use something like xdg-run/kate
instead of /tmp
for temporary files.
@travier I tried once more to make sure I wasn't getting anything wrong.
The thing is we want a path that is accessible by both the host and flatpak. If we use $XDG_RUNTIME_DIR/kate, host processes fail to access the temporary files we create. There might be a way to convert xdg-run/kate to a proper host path but I am not sure if that would be a reliable way and most likely that wouldn't be an acceptable solution as it requires us changing + ensuring all the scenarios work.
In contrast, /tmp
just works. So I think this is the simplest solution that will work for now.
Did you make sure to grant the Kate Flatpak access to xdg-run/kate
when testing this? This path should be accessible both outside and inside the Flatpak.
Edit: I've just tried it and it needs to be created outside before the Flatpak startup to be accessible inside:
$ cd $XDG_RUNTIME_DIR
$ mkdir kate
$ touch kate/foo
$ flatpak run --filesystem=xdg-run/kate --command=bash org.kde.kcalc
$ ls $XDG_RUNTIME_DIR/kate
foo
OK, so that makes it not a viable solution
/tmp
it is 😢
I tried to create a directory when launching up by running mkdir, the directory does get created but it is not usable during that session. On the next session it works.
Following up from https://github.com/flathub/org.kde.kate/pull/24
The reason is that Kate invokes processes on the host and then passes the temporary file as an argument.
E.g.,
The new formatter plugin (v23.04) will
git
to diff the document before formatting with the temporary fileSimilarly, the project plugin stores the ctag index into a temporary file. This file is passed as an argument to the ctags process.
We use
QTemporaryFile
to create and manage temporary files.@travier