syd711 / vpin-studio

Competition, table, and player management for VPins.
MIT License
28 stars 2 forks source link

[Bug] Can't edit script files on Linux client #328

Closed dmccombs closed 1 month ago

dmccombs commented 2 months ago

Describe the bug When clicking "Edit script" from a vpin-studio client running on Linux, it fails to open and displays an error Failed to open vbs file: Cannot run program "open": error=2, No such file or directory

To Reproduce Steps to reproduce the behavior:

  1. Open vpin-studio client on Linux and connect to a server
  2. Select a table, click Script Details, then Edit Script
  3. No text editor opens and the following error is displayed: Failed to open vbs file: Cannot run program "open": error=2, No such file or directory

Expected behavior The default system text editor is opened

Screenshots shot-2024-07-05_08-25-10

Desktop (please complete the following information):

Additional context I haven't looked into it too much, but wanted to submit this before I forgot. Maybe when the client is running on Linux it should be calling xdg-open rather than open?

syd711 commented 2 months ago

I never tested the script editing on Linux. But yes, xdg-open sounds a like a better alternative.

syd711 commented 1 month ago

I've made a blind fix for this in 2.21.4. I can't test it right now, because I haven't my working pc at hand, but I hope it solved your issue.

dmccombs commented 1 month ago

@syd711 Hmm. 2.21.4 doesn't throw the open error anymore, but silently doesn't actually open anything to edit the script with when clicking Edit Script. Looking at the output, it is writing the .vbs file out:

06-07 10:16:38.184 [JavaFX Application Thread] INFO  o.s.w.c.RestTemplate - HTTP POST api/v1/textedit/open (369ms)
06-07 10:16:38.185 [JavaFX Application Thread] INFO  d.m.v.u.t.v.VBSManager - Deleted existing /home/dmccombs/VPin-Studio/./resources/vbs/MedievalMadness_Upgrade(Real_Final)[36].vbs
06-07 10:16:38.186 [JavaFX Application Thread] INFO  d.m.v.u.t.v.VBSManager - Written .vbs file '/home/dmccombs/VPin-Studio/./resources/vbs/MedievalMadness_Upgrade(Real_Final)[36].vbs'

I made sure I have an application set to open VBS files, and running xdg-open /home/dmccombs/VPin-Studio/./resources/vbs/MedievalMadness_Upgrade(Real_Final)[36].vbs' correctly opens the editor, and editing it there and saving is picked up and uploaded by VPin Studio correctly:

06-07 10:20:20.095 [pool-7-thread-1] INFO  d.m.v.u.t.v.VbsMonitoringService - VBS monitor: /home/dmccombs/VPin-Studio/./resources/vbs/MedievalMadness_Upgrade(Real_Final)[36].vbs has changed (ENTRY_MODIFY)
06-07 10:20:20.757 [pool-7-thread-1] INFO  o.s.w.c.RestTemplate - HTTP POST api/v1/textedit/save (660ms)
06-07 10:20:20.757 [pool-7-thread-1] INFO  d.m.v.u.t.v.VbsMonitoringService - Imported vbs file /home/dmccombs/VPin-Studio/MedievalMadness_Upgrade(Real_Final)[36].vbs
06-07 10:20:20.772 [JavaFX Application Thread] INFO  o.s.w.c.RestTemplate - HTTP GET http://192.168.1.113:8089/api/v1/games/36 (14ms)
06-07 10:20:20.772 [LoadingThreadFor_1] INFO  d.m.v.r.c.VPinStudioClient - Start the loading of known games for emulator 1
06-07 10:20:21.019 [LoadingThreadFor_1] INFO  o.s.w.c.RestTemplate - HTTP GET http://192.168.1.113:8089/api/v1/games/knowns/1 (247ms)
06-07 10:20:21.037 [JavaFX Application Thread] INFO  o.s.w.c.RestTemplate - HTTP GET http://192.168.1.113:8089/api/v1/vpx/tableinfo/36 (13ms)

So maybe VPin Studio just isn't calling anything at all to open the file after writing it out now?

syd711 commented 1 month ago

It was worth a try. I'll take a second look. Thank's for your feedback.

dmccombs commented 1 month ago

@syd711 I went to play around with this (I think it might just need to be /bin/sh xdg-open rather than simply xdg-open from Runtime.getRuntime().exec), but I found I can't build VPin Studio myself, it fails with a missing dependency ofde.mephisto.vpin:vpin-mania-rest-client:jar:1.0.0 that I don't see available in your github repositories. Is there somewhere else I should get it from? Thanks!

[INFO] --------------< de.mephisto.vpin:vpin-studio-rest-client >--------------
[INFO] Building vpin-studio-rest-client 2.21.4                           [6/12]
[INFO]   from vpin-studio-rest-client/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for de.mephisto.vpin:vpin-mania-rest-client:jar:1.0.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] vpin-connector-assets 1.0.0 ........................ SUCCESS [  0.772 s]
[INFO] studio 2.21.4 ...................................... SUCCESS [  0.002 s]
[INFO] vpin-connector-discord 2.21.4 ...................... SUCCESS [  0.838 s]
[INFO] vpin-connector-iscored 2.21.4 ...................... SUCCESS [  1.198 s]
[INFO] vpin-connector-vps 2.21.4 .......................... SUCCESS [  1.717 s]
[INFO] vpin-studio-rest-client 2.21.4 ..................... FAILURE [  0.028 s]
[INFO] vpin-studio-commons 2.21.4 ......................... SKIPPED
[INFO] vpin-studio-table-manager 2.21.4 ................... SKIPPED
[INFO] vpin-studio-server 2.21.4 .......................... SKIPPED
[INFO] vpin-studio-ui 2.21.4 .............................. SKIPPED
[INFO] vpin-tools 2.21.4 .................................. SKIPPED
[INFO] vps-bot 2.21.4 ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.684 s
[INFO] Finished at: 2024-07-09T17:47:02-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project vpin-studio-rest-client: Could not resolve dependencies for project de.mephisto.vpin:vpin-studio-rest-client:jar:2.21.4
[ERROR] dependency: de.mephisto.vpin:vpin-mania-rest-client:jar:1.0.0 (compile)
[ERROR]         de.mephisto.vpin:vpin-mania-rest-client:jar:1.0.0 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the lo
cal repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced
syd711 commented 1 month ago

Hi Dan, I fixed both of your issues and will push out the update this evening. Sorry, the setup is a bit cumbersome and I was too lazy to simplify it. But If you are interested in the development, I can set you up, as some of the depending repositories are private.

syd711 commented 1 month ago

Solved with 2.21.5

dmccombs commented 1 month ago

@syd711 yes, both editing scripts and opening links on Linux is working in 2.21.5 - thanks!

As far as my being able to build vpin-studio for development, it's certainly up to you with private repos being involved. I feel bad just opening issues and never PRs, with vpinball in general seeming like a pretty small community. At the least it would allow me to test changes before releases if needed, but also possibly help with other development or fixes depending what comes up at some point.