Skip to content

Commit

Permalink
Add support for custom builds of Godot (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
nongvantinh authored Oct 12, 2024
1 parent 21e3c97 commit 386b282
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59741,8 +59741,11 @@ async function getGodotVersion() {
versionLines = versionLines.filter(x => !!x.trim());
version = versionLines.pop() || 'unknown';
version = version.trim();
version = version.replace('.official', '').replace(/\.[a-z0-9]{9}$/g, '');
if (!version) {
const regex = /(\d+(\.\d+)+\.\w+(\.mono)?)/;
const match = version.match(regex);
if (match) {
version = match[1];
} else {
throw new Error('Godot version could not be determined.');
}
return version;
Expand Down
10 changes: 6 additions & 4 deletions src/godot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,12 @@ async function getGodotVersion(): Promise<string> {
versionLines = versionLines.filter(x => !!x.trim());
version = versionLines.pop() || 'unknown';
version = version.trim();
version = version.replace('.official', '').replace(/\.[a-z0-9]{9}$/g, '');

if (!version) {
throw new Error('Godot version could not be determined.');
const regex = /(\d+(\.\d+)+\.\w+(\.mono)?)/;
const match = version.match(regex);
if (match) {
version = match[1];
} else {
throw new Error('Godot version could not be determined.');
}

return version;
Expand Down

0 comments on commit 386b282

Please sign in to comment.