richardwilkes / gcs

GURPS Character Sheet
http://gurpscharactersheet.com
Mozilla Public License 2.0
225 stars 63 forks source link

Files on Ubuntu Network Drive (specifically gnome online-accounts) cannot be loaded using Zenity #879

Open WIGGLES-dev opened 3 months ago

WIGGLES-dev commented 3 months ago

As the subject suggests, when selecting a file to open using the Zenity dialog box selecting anything in a network drive does nothing in the GCS UI. There's no crash, but the sheet does not open. If I copy the file I tried to open from the network drive to my normal drive it works fine. I suspect this may have always been the case, but I do this constantly on windows with google backup and sync which use a virtual mounted drive.

richardwilkes commented 3 months ago

Is there an error in the log? Hopefully a path that it tried to load and failed, which might be enlightening. Could be what I'm getting back from the external program has something unexpected in it.

I do have a basic implementation of the file dialogs that I could provide a way to enable in some future release. Right now, its just there as a fallback when I can't find one of the "standard" things on Linux. On Mac & Win, I just use the native system file dialogs. Too bad there isn't really a standard on Linux I can guarantee is always there.

WIGGLES-dev commented 3 months ago

ERR | 2024-08-17 | 18:19:40.517 | Invalid file data. [github.com/richardwilkes/gcs/v5/model/gurps.NewEntityFromFile] entity.go:132 [github.com/richardwilkes/gcs/v5/ux.NewSheetFromFile] sheet.go:110 [github.com/richardwilkes/gcs/v5/ux.RegisterGCSFileTypes.registerExportableGCSFileInfo.func1] file_types.go:160 [github.com/richardwilkes/gcs/v5/ux.OpenFile] navigator.go:1198 [github.com/richardwilkes/gcs/v5/ux.OpenFiles] navigator.go:1112 [github.com/richardwilkes/gcs/v5/ux.registerActions.func21] actions.go:630 [github.com/richardwilkes/unison.(Action).Execute.func1] github.com/richardwilkes/unison@v0.68.1/action.go:69 [github.com/richardwilkes/toolbox.CallWithHandler] github.com/richardwilkes/toolbox@v1.110.0/call.go:24 [github.com/richardwilkes/toolbox.Call] github.com/richardwilkes/toolbox@v1.110.0/call.go:18 [github.com/richardwilkes/unison.(Action).Execute] github.com/richardwilkes/unison@v0.68.1/action.go:69 [github.com/richardwilkes/unison.(Action).execute] github.com/richardwilkes/unison@v0.68.1/action.go:74 [github.com/richardwilkes/unison.(menuItem).execute.func1] github.com/richardwilkes/unison@v0.68.1/menu_item.go:371 [github.com/richardwilkes/toolbox.CallWithHandler] github.com/richardwilkes/toolbox@v1.110.0/call.go:24 [github.com/richardwilkes/toolbox.Call] github.com/richardwilkes/toolbox@v1.110.0/call.go:18 [github.com/richardwilkes/unison.(menuItem).execute] github.com/richardwilkes/unison@v0.68.1/menu_item.go:371 [github.com/richardwilkes/unison.(menuItem).mouseUp] github.com/richardwilkes/unison@v0.68.1/menu_item.go:190 [github.com/richardwilkes/unison.(Window).mouseUp.func2] github.com/richardwilkes/unison@v0.68.1/window.go:1092 [github.com/richardwilkes/toolbox.CallWithHandler] github.com/richardwilkes/toolbox@v1.110.0/call.go:24 [github.com/richardwilkes/toolbox.Call] github.com/richardwilkes/toolbox@v1.110.0/call.go:18 [github.com/richardwilkes/unison.(Window).mouseUp] github.com/richardwilkes/unison@v0.68.1/window.go:1092 [github.com/richardwilkes/unison.(Window).mouseButtonCallback] github.com/richardwilkes/unison@v0.68.1/window.go:343 [github.com/go-gl/glfw/v3.3/glfw.goMouseButtonCB] github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240307211618-a69d953ea142/input.go:333 [_cgoexp_84caf159b0bb_goMouseButtonCB] _cgo_gotypes.go:2652 [github.com/go-gl/glfw/v3.3/glfw._Cfunc_glfwWaitEvents] _cgo_gotypes.go:2566 [github.com/go-gl/glfw/v3.3/glfw.WaitEvents] github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240307211618-a69d953ea142/window.go:949 [github.com/richardwilkes/unison.processEvents] github.com/richardwilkes/unison@v0.68.1/app.go:163 [github.com/richardwilkes/unison.Start] github.com/richardwilkes/unison@v0.68.1/app.go:158 [github.com/richardwilkes/gcs/v5/ux.Start] startup.go:34 [main.main] github.com/richardwilkes/gcs/v5/main.go:94 Caused by: invalid UUID length: 17 [github.com/richardwilkes/gcs/v5/model/jio.Load] load.go:57 [github.com/richardwilkes/gcs/v5/model/jio.LoadFromFS] load.go:44 [github.com/richardwilkes/gcs/v5/model/gurps.NewEntityFromFile] entity.go:131 [github.com/richardwilkes/gcs/v5/ux.NewSheetFromFile] sheet.go:110 [github.com/richardwilkes/gcs/v5/ux.RegisterGCSFileTypes.registerExportableGCSFileInfo.func1] file_types.go:160 [github.com/richardwilkes/gcs/v5/ux.OpenFile] navigator.go:1198 [github.com/richardwilkes/gcs/v5/ux.OpenFiles] navigator.go:1112 [github.com/richardwilkes/gcs/v5/ux.registerActions.func21] actions.go:630 [github.com/richardwilkes/unison.(Action).Execute.func1] github.com/richardwilkes/unison@v0.68.1/action.go:69 [github.com/richardwilkes/toolbox.CallWithHandler] github.com/richardwilkes/toolbox@v1.110.0/call.go:24 [github.com/richardwilkes/toolbox.Call] github.com/richardwilkes/toolbox@v1.110.0/call.go:18 [github.com/richardwilkes/unison.(Action).Execute] github.com/richardwilkes/unison@v0.68.1/action.go:69 [github.com/richardwilkes/unison.(Action).execute] github.com/richardwilkes/unison@v0.68.1/action.go:74 [github.com/richardwilkes/unison.(menuItem).execute.func1] github.com/richardwilkes/unison@v0.68.1/menu_item.go:371 [github.com/richardwilkes/toolbox.CallWithHandler] github.com/richardwilkes/toolbox@v1.110.0/call.go:24 [github.com/richardwilkes/toolbox.Call] github.com/richardwilkes/toolbox@v1.110.0/call.go:18 [github.com/richardwilkes/unison.(menuItem).execute] github.com/richardwilkes/unison@v0.68.1/menu_item.go:371 [github.com/richardwilkes/unison.(menuItem).mouseUp] github.com/richardwilkes/unison@v0.68.1/menu_item.go:190 [github.com/richardwilkes/unison.(Window).mouseUp.func2] github.com/richardwilkes/unison@v0.68.1/window.go:1092 [github.com/richardwilkes/toolbox.CallWithHandler] github.com/richardwilkes/toolbox@v1.110.0/call.go:24 [github.com/richardwilkes/toolbox.Call] github.com/richardwilkes/toolbox@v1.110.0/call.go:18 [github.com/richardwilkes/unison.(Window).mouseUp] github.com/richardwilkes/unison@v0.68.1/window.go:1092 [github.com/richardwilkes/unison.(Window).mouseButtonCallback] github.com/richardwilkes/unison@v0.68.1/window.go:343 [github.com/go-gl/glfw/v3.3/glfw.goMouseButtonCB] github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240307211618-a69d953ea142/input.go:333 [_cgoexp_84caf159b0bb_goMouseButtonCB] _cgo_gotypes.go:2652 [github.com/go-gl/glfw/v3.3/glfw._Cfunc_glfwWaitEvents] _cgo_gotypes.go:2566 [github.com/go-gl/glfw/v3.3/glfw.WaitEvents] github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240307211618-a69d953ea142/window.go:949 [github.com/richardwilkes/unison.processEvents] github.com/richardwilkes/unison@v0.68.1/app.go:163 [github.com/richardwilkes/unison.Start] github.com/richardwilkes/unison@v0.68.1/app.go:158 [github.com/richardwilkes/gcs/v5/ux.Start] startup.go:34 [main.main] github.com/richardwilkes/gcs/v5/main.go:94

WIGGLES-dev commented 3 months ago

I suspect this is not the right log file, but it's the only one from today (that likely appeared when I tried to install an older version to see if this issue I was seeing was new or old).

richardwilkes commented 3 months ago

Yeah, the older version likely couldn't read the new file format.

WIGGLES-dev commented 3 months ago

if it's helpful at all, the Gnome online-accounts mounted drive uses a very non-standard google-drive: scheme when I check folder properties in the UI. So if GCS expects a path that is /some/normal/linux/path/sheet.gcs I can totally understand why it may fail.

richardwilkes commented 3 months ago

Yes, GCS is definitely expecting a path it can use with a normal file system call.

WIGGLES-dev commented 3 months ago

Other apps in Ubuntu don't seem to have a problem opening files on the network drive so a normal filesystem call should resolve properly.

WIGGLES-dev commented 3 months ago

though when I open it up in VScode for Ubuntu I think it is getting resolved through some sort of link to a completely different location on disk

richardwilkes commented 3 months ago

Can you copy & paste an example path as it would be given to GCS after the call to Zenity?

WIGGLES-dev commented 3 months ago

in the UI the folder resolves to google-drive://my.email@notmyrealemail.com/0AHR25jh33zAxUk9PVA/0B3R25jh33zAxb0FrM0dJcDJHUG8/1sEFTA10YZ4ojA4RX_TQrfX98Yf0BVdBo/character.gcs

When I open this in vscode it will resolve to /run/user/1000/gvfs/google-drive:host=notmyrealemail.com,user=my.email/ and then its followed by google drive IDs that map to my drive folders. They don't have extensions, so I can't actually open them in GCS because the dialog won't let me.

richardwilkes commented 3 months ago

That sounds like it only works in VSCode because VSCode is nothing more than a wrapper around a browser and it is asking the system to resolve the drive:// URL type and return a byte stream to then load. I could do something similar with some effort (in theory, anyway), but it would mean adding URL detectors into that code, which I'm not certain I want to permit.

WIGGLES-dev commented 3 months ago

I'm not sure about the specifics about how gnome-online-accounts work. From the UI you can see it as a mounted drive, but that's about all I know. Other gnome applications like the text editor can open it. I can tell for certain that the actual files live on disk in /run (because this is just a virtual file system) and you certainly can't use google-drive:// in the terminal to try to read files (obviously because it is mounted somewhere else). My guess is that whatever file dialog you're using isn't smart enough to tell that google-drive:// is actually a virtually mounted network drive and should try to resolve that to it's actual disk location.

richardwilkes commented 3 months ago

I'm open to other suggestions for linux. As it stands today, for linux only, I try to use either kdialog or zenity, whichever is present and more suitable. If neither is, then I put up my own custom file dialog. I expect those utilities to return usable disk-based paths. If they fail to do so, then things don't work. I would have assumed whatever is providing this virtual disk would provide it in such a way that it would indeed look like a disk location, not a web URL... but that appears not to be the case.

As far as I'm aware, those two utility programs are the closest that linux has to system file dialogs. The other option is adopting gnome or kde or (flavor-of-the-month) toolkits... but those come with a huge amount of baggage that make it difficult, especially if you aren't using C/C++ for your code. I'd likely drop linux support altogether before going that route.

richardwilkes commented 3 months ago

Just found this: https://astrada.github.io/google-drive-ocamlfuse/ which looks like it might allow you to present the files to everything on your system as just another actual filesystem via FUSE, rather than whatever the gnome integration thing is doing. May not be something you want to do, but thought I'd mention it.