mirror of
https://github.com/chickensoft-games/setup-godot.git
synced 2025-08-15 13:25:07 +00:00
fix: read specified global.json file (#31)
This commit is contained in:
parent
c61b59a7c8
commit
5880cd9daf
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
@ -78,8 +78,10 @@ function run(platform) {
|
|||||||
if (!hasGlobalJsonFile) {
|
if (!hasGlobalJsonFile) {
|
||||||
throw new Error(`🚨 Cannot find global.json file to infer the Godot version from.`);
|
throw new Error(`🚨 Cannot find global.json file to infer the Godot version from.`);
|
||||||
}
|
}
|
||||||
const globalJsonFileContents = fs.readFileSync('global.json', 'utf8');
|
const globalJsonFileContents = fs.readFileSync(globalJsonPath, 'utf8');
|
||||||
|
core.info(`🖨 global.json contents: ${globalJsonFileContents}`);
|
||||||
const globalJson = (_b = JSON.parse(globalJsonFileContents)) !== null && _b !== void 0 ? _b : {};
|
const globalJson = (_b = JSON.parse(globalJsonFileContents)) !== null && _b !== void 0 ? _b : {};
|
||||||
|
core.info(`🖨 global.json parsed contents: ${JSON.stringify(globalJsonFileContents, null, 2)}`);
|
||||||
version = (_c = globalJson['msbuild-sdks']['Godot.NET.Sdk']) !== null && _c !== void 0 ? _c : '';
|
version = (_c = globalJson['msbuild-sdks']['Godot.NET.Sdk']) !== null && _c !== void 0 ? _c : '';
|
||||||
}
|
}
|
||||||
// Compute derived information from Godot version.
|
// Compute derived information from Godot version.
|
||||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
10
src/main.ts
10
src/main.ts
@ -46,8 +46,16 @@ async function run(platform: Platform): Promise<void> {
|
|||||||
`🚨 Cannot find global.json file to infer the Godot version from.`
|
`🚨 Cannot find global.json file to infer the Godot version from.`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
const globalJsonFileContents = fs.readFileSync('global.json', 'utf8')
|
const globalJsonFileContents = fs.readFileSync(globalJsonPath, 'utf8')
|
||||||
|
core.info(`🖨 global.json contents: ${globalJsonFileContents}`)
|
||||||
const globalJson = JSON.parse(globalJsonFileContents) ?? {}
|
const globalJson = JSON.parse(globalJsonFileContents) ?? {}
|
||||||
|
core.info(
|
||||||
|
`🖨 global.json parsed contents: ${JSON.stringify(
|
||||||
|
globalJsonFileContents,
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)}`
|
||||||
|
)
|
||||||
version = globalJson['msbuild-sdks']['Godot.NET.Sdk'] ?? ''
|
version = globalJson['msbuild-sdks']['Godot.NET.Sdk'] ?? ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user