Antyos / vscode-openscad

An OpenSCAD extension for VS Code
GNU General Public License v3.0
107 stars 17 forks source link

OpenSCAD launch is not working #62

Open snlitotes opened 2 months ago

snlitotes commented 2 months ago

Problem If I specify the launch path to e.g.: "openscad.launchPath": "d:\PortableApps\PortableApps\OpenSCADPortable\OpenSCADPortable.exe" then the launcher exits with an error message:

Cannot find the command: "d:\PortableApps\PortableApps\OpenSCADPortable\OpenSCADPortable.exe". Make sure OpenSCAD is installed. You may need to specify the installation path under `Settings > OpenSCAD > Launch Path`

Background To run OpenSCAD in a portable environment there is a wrapper executable needed that must have a different name from openscad.exe. So it is needed that the plugin-launcher is capable to run a launch path that can have an arbitrary name.

snlitotes commented 2 months ago

The reason might be that the OpenSCADportable wrapper forwards the command line parameters to openscad.exe but does not print any values to the console. So d:\PortableApps\PortableApps\OpenSCADPortable\OpenSCADPortable.exe --version would not produce any output. PortableApps.com is very common - so changing its launcher is not very likely.

Antyos commented 2 months ago

I've never heard of PortableApps before--I don't see OpenSCAD listed in their apps (https://portableapps.com/apps), where did you download it from? Not being able to forward command line output in a wrapper seems like a strange oversight. I wonder if it's a potential issue with the way it was generated.

Regardless, this may be a sign that I should create an "advanced" option to skip the version check. The previous way of checking the validity of the openscad exe was to check if the file itself existed, but this caused issues for use with Flatpak (#36). I don't really like "skip safety checks" as a principle, but I'm not sure how else to resolve this issue. Suggestions are welcome.

snlitotes commented 2 months ago

You see it not listed because nobody ported it to portableapps.com yet. This was my intent. My problem is that the portableapps launcher (based on NSIS) does not pass return values back to the console. I already had a hard to find out how to pass console messages back with NSIS. But the concept of it just did not forsee it. Skipping the version check would be an option. And I fully agree - just skipping safety checks is ugly. I would do that neither. If you like you can leave this issue open until somebody else comes with the same request or you just close it as not planned. Both is fine for me.

fenhl commented 1 month ago

I installed OpenSCAD using Scoop and I'm having the same issue — its shim for the openscad command also doesn't output anything when running openscad --version.

Antyos commented 1 month ago

I really wish these wrappers would respect command line output, but there's no point in complaining about something far beyond my control.

Maybe the solution should then be to check if the command runs successfully rather than listening for specific output. If there is no output to openscad --version, then it sets the version to undefined, but still continues as normal. In principle, I wanted to confirm the nature of the openscad executable before calling it with any real files, but perhaps that has caused more trouble than it's been worth.

I'll see what I can do about considering a valid executable to be one which can call openscad --version that doesn't write to stderr (such as calling a non-existent file).

fenhl commented 4 weeks ago

I have reported the missing version output as a bug to Scoop: https://github.com/ScoopInstaller/Extras/issues/13425