williamoberg / godot-dotnet-tools

Generate .NET related files for your Godot project
https://marketplace.visualstudio.com/items?itemName=woberg.godot-dotnet-tools
MIT License
9 stars 0 forks source link

Proposal: ask for the "Godot file path" at the Installation Time #4

Closed joined72 closed 7 months ago

joined72 commented 7 months ago

Why don't wait that the user edit the settings.json/godot-dotnet-tools.executablePath variable and ask him to select the Godot file path at the installation time using something like the following example?

// Show the file dialog
let fileUris = await vscode.window.showOpenDialog(canSelectFolders: false, canSelectFiles: true, canSelectMany: false, openLabel: 'Select Godot Executable File...');
if (fileUris && fileUris.length > 0) {
    // Get the first selected file path
    let filePath = fileUris[0].fsPath;
    // Store the file path in the user settings
    let config = vscode.workspace.getConfiguration('yourExtension');
    await config.update('filePath', filePath, vscode.ConfigurationTarget.Global);
}
williamoberg commented 7 months ago

Yes, again good proposal! Probably when generating files for the first time/when the path is not set, this should be done!

williamoberg commented 7 months ago

I'll see if i can do it tonight, otherwise I'll do it tomorrow!

joined72 commented 7 months ago

I'll see if i can do it tonight, otherwise I'll do it tomorrow!

Thanks a lot for your availability and great work! 👍

williamoberg commented 7 months ago

@joined72 It's implemented now!

Now when generating the files and the path in the user settings is not valid (or empty), you get a file dialog to choose your executable. It then sets your config settings and generates the launch file (if it doesn't already exist) 👍

I have only tested it on Windows so far, but I think it should work on mac and linux as well. As always, please let me know if it works for you and if you have any issues!

joined72 commented 7 months ago

Great, I'll test on both Windows and Linux tomorrow on morning. I'll let you updated ASAP. ;)

williamoberg commented 7 months ago

Cool, thanks!

joined72 commented 7 months ago

Testes and works fine on both Windows and Linux with only a little issue on the Linux side, when try to select the Godot executable the file isn't showed (I suppose you use as filter *.exe that on Linux and MacOS doesn't works) and I must change the file type (from the dialog) from "Executable" to "All files".

williamoberg commented 7 months ago

Okay I kind of suspected this.. I added .exe, .bin, .app and a few more in the filters but maybe linux uses some other extension.

I think i might remove the filters all together then. Thanks for testing! 👍

williamoberg commented 7 months ago

Updated now!

joined72 commented 7 months ago

Linux haven't a standard extension for executable files! :) Great :)

williamoberg commented 7 months ago

Again, thanks for the help and the good suggestions! Very much appreciated 🥇

The extension feels alot more user friendly now I think.

joined72 commented 7 months ago

Again, thanks for the help and the good suggestions! Very much appreciated 🥇

I'm very happy to can help.

The extension feels alot more user friendly now I think.

Yes, it is! :)