Skip to content

Commit

Permalink
Fix extension for 4.0
Browse files Browse the repository at this point in the history
- The `.mono` folder was moved to `.godot/mono`
- The `--remote-debug` argument now requires the protocol
  • Loading branch information
raulsntos committed Feb 15, 2022
1 parent aedd1af commit f68fd19
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 14 additions & 1 deletion GodotDebugSession/GodotDebuggerSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,25 @@ protected override async void OnRun(DebuggerStartInfo startInfo)
string host = "127.0.0.1";
int remoteDebugPort = ((IPEndPoint)remoteDebugListener.LocalEndpoint).Port;

// Construct the --remote-debug parameter for the found version of Godot

var versionCommand = Command.Run(godotStartInfo.GodotExecutablePath, new[] { "--version" }).Result;
string versionOutput = versionCommand.StandardOutput;
int versionFirstDot = versionOutput.IndexOf('.');
if (versionFirstDot == -1 || !int.TryParse(versionOutput.Substring(0, versionFirstDot), out int versionMajor))
{
Logger.Log($"Godot launch request failed: Godot version unrecognized: {versionOutput}.");
Exit();
return;
}
string remoteDebugAddress = versionMajor >= 4 ? $"tcp://{host}:{remoteDebugPort}" : $"{host}:{remoteDebugPort}";

// Launch Godot to run the game and connect to our remote debugger

var args = new List<string>()
{
"--path", workingDir,
"--remote-debug", $"{host}:{remoteDebugPort}",
"--remote-debug", remoteDebugAddress,
};
args.AddRange(godotStartInfo.ExecutableArguments);

Expand Down
6 changes: 5 additions & 1 deletion src/godot-tools-messaging/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ export class Client implements Disposable {
this.logger = logger;

this.projectDir = godotProjectDir;
this.projectMetadataDir = path.join(godotProjectDir, '.mono', 'metadata');
this.projectMetadataDir = path.join(godotProjectDir, '.godot', 'mono', 'metadata');
if (!fs.existsSync(this.projectMetadataDir)) {
// Fallback for 3.x projects
this.projectMetadataDir = path.join(godotProjectDir, '.mono', 'metadata');
}

this.metaFilePath = path.join(this.projectMetadataDir, GodotIdeMetadata.defaultFileName);
}
Expand Down

0 comments on commit f68fd19

Please sign in to comment.