Storing work directory and importing files from gvfs-fuse
My goal is to have my work directory on a shared network location (SMB) to be able to access it from multiple computers. On Linux, the cleanest way for me to do this is to have the share mounted in GVFS. Since paperwork currently only supports 'file://' URLs, my thinking was that I should still be able to do this using gvfs-fuse - it provides a mount point for the remote file system in /run/user/UID/gvfs.
However, I ran into an interesting issue. It appears that because paperwork-gtk uses Gio.Vfs, the gvfs-fuse URL (file:///run/user/UID/gvfs/smb-share:server=_SERVERNAME_) gets re-written to the corresponding samba url (smb://....) whenever get_uri is called in functions like openpaperwork_gtk.fs.gio.fs_listdir.
I would like to propose switching the GTK dialogs and VFS code to 'local' mode. In my case, it prevents the fs code from rewriting the file:// url to a smb:// url. Since paperwork currently only supports 'file://' urls, it seems like this should not limit any current use cases. I will submit a pull request for this change. I don't have a good windows development setup, so I have not been able to confirm if this breaks anything on windows especially with mounted network drives. I would appreciate someone checking on that if possible.
After figuring out the patch, I did also find a workaround to put the VFS in local mode without a code change, but I still wanted to offer the patch in case anyone else runs into this.
The workaround is to set the GIO_USE_VFS environment variable before running paperwork: GIO_USE_VFS=local flatpak run --filesystem=xdg-run/gvfs work.openpaper.Paperwork
As a side note, I would be interested in trying to add support for the non-'file://' urls directly if there is any interest in me submitting that as a patch. Much bigger task so I didn't want to start on that without asking.