mirror of
https://github.com/chickensoft-games/setup-godot.git
synced 2025-08-14 12:55:08 +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) {
|
||||
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 : {};
|
||||
core.info(`🖨 global.json parsed contents: ${JSON.stringify(globalJsonFileContents, null, 2)}`);
|
||||
version = (_c = globalJson['msbuild-sdks']['Godot.NET.Sdk']) !== null && _c !== void 0 ? _c : '';
|
||||
}
|
||||
// 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.`
|
||||
)
|
||||
}
|
||||
const globalJsonFileContents = fs.readFileSync('global.json', 'utf8')
|
||||
const globalJsonFileContents = fs.readFileSync(globalJsonPath, 'utf8')
|
||||
core.info(`🖨 global.json contents: ${globalJsonFileContents}`)
|
||||
const globalJson = JSON.parse(globalJsonFileContents) ?? {}
|
||||
core.info(
|
||||
`🖨 global.json parsed contents: ${JSON.stringify(
|
||||
globalJsonFileContents,
|
||||
null,
|
||||
2
|
||||
)}`
|
||||
)
|
||||
version = globalJson['msbuild-sdks']['Godot.NET.Sdk'] ?? ''
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user