From 34671f299f0958a1cfdab386409a00e770e71a37 Mon Sep 17 00:00:00 2001 From: Ramon Brullo Date: Tue, 9 Jan 2024 13:20:12 +0100 Subject: [PATCH] fix: manifest save crash Currently the app crashes when trying to save the project-manifest if the target folder does not exist. This can be annyoing in test scenarios. This fix creates the [Project]/Packages folder if it does not exist. --- src/utils/project-manifest-io.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/project-manifest-io.ts b/src/utils/project-manifest-io.ts index b0452051..7d339e65 100644 --- a/src/utils/project-manifest-io.ts +++ b/src/utils/project-manifest-io.ts @@ -5,6 +5,8 @@ import { manifestPathFor, UnityProjectManifest, } from "../types/project-manifest"; +import fse from "fs-extra"; +import path from "path"; /** * Attempts to load the manifest from the path specified in env @@ -41,6 +43,7 @@ export const saveProjectManifest = function ( const manifestPath = manifestPathFor(workingDirectory); const json = JSON.stringify(data, null, 2); try { + fse.ensureDirSync(path.dirname(manifestPath)); fs.writeFileSync(manifestPath, json); return true; } catch (err) {