Skip to content

Commit

Permalink
fix: manifest save crash (#98)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ComradeVanti committed Jan 9, 2024
1 parent 5624edc commit 0bf3096
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/project-manifest-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 0bf3096

Please sign in to comment.