Removing existing installations before extracting downloaded ZIP

This commit is contained in:
Lulu 2024-01-29 22:57:55 +00:00
parent 1cfb3bae72
commit 0fb1a0852c
3 changed files with 15 additions and 1 deletions

6
dist/index.js generated vendored
View File

@ -140,6 +140,9 @@ function run(platform) {
core.endGroup();
// Extract Godot
core.startGroup(`📦 Extracting Godot to ${installationDir}...`);
// If the export template folder already exists, remove it before extracting the ZIP file. This will "uninstall" other installations (e.g. on version changes).
if (fs.existsSync(installationDir))
fs.rmdirSync(installationDir);
const godotExtractedPath = yield toolsCache.extractZip(godotDownloadedPath, installationDir);
core.info(`✅ Godot extracted to ${godotExtractedPath}`);
core.endGroup();
@ -149,6 +152,9 @@ function run(platform) {
core.info(`✅ Files shown`);
core.endGroup();
core.startGroup(`📦 Extracting Export Templates to ${exportTemplatePath}...`);
// If the export template folder already exists, remove it before extracting the ZIP file. This will "uninstall" other installations (e.g. on version changes).
if (fs.existsSync(exportTemplatePath))
fs.rmdirSync(exportTemplatePath);
const exportTemplateExtractedPath = yield toolsCache.extractZip(templateDownloadedPath, path_1.default.dirname(exportTemplatePath));
core.info(`✅ Export Templates extracted to ${exportTemplateExtractedPath}`);
fs.renameSync(path_1.default.join(exportTemplateExtractedPath, 'templates'), exportTemplatePath);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -148,6 +148,10 @@ async function run(platform: Platform): Promise<void> {
// Extract Godot
core.startGroup(`📦 Extracting Godot to ${installationDir}...`)
// If the export template folder already exists, remove it before extracting the ZIP file. This will "uninstall" other installations (e.g. on version changes).
if (fs.existsSync(installationDir)) fs.rmdirSync(installationDir)
const godotExtractedPath = await toolsCache.extractZip(
godotDownloadedPath,
installationDir
@ -168,6 +172,10 @@ async function run(platform: Platform): Promise<void> {
core.startGroup(
`📦 Extracting Export Templates to ${exportTemplatePath}...`
)
// If the export template folder already exists, remove it before extracting the ZIP file. This will "uninstall" other installations (e.g. on version changes).
if (fs.existsSync(exportTemplatePath)) fs.rmdirSync(exportTemplatePath)
const exportTemplateExtractedPath = await toolsCache.extractZip(
templateDownloadedPath,
path.dirname(exportTemplatePath)