Skip to content

Commit

Permalink
fix: handle undefined
Browse files Browse the repository at this point in the history
Throw if upm-config dir-path could not be resolved
  • Loading branch information
ComradeVanti committed Oct 24, 2023
1 parent dc1e931 commit 9108970
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export const saveManifest = function (data: PkgManifest) {

// Get .upmconfig.toml directory
export const getUpmConfigDir = async function (): Promise<string> {
let dirPath = "";
let dirPath: string | undefined = "";
const systemUserSubPath = "Unity/config/ServiceAccounts";
if (env.wsl) {
if (!isWsl) {
Expand All @@ -387,8 +387,6 @@ export const getUpmConfigDir = async function (): Promise<string> {
});
}
} else {
// TODO: Handle undefined
// @ts-ignore
dirPath = process.env.USERPROFILE
? process.env.USERPROFILE
: process.env.HOME;
Expand All @@ -399,6 +397,8 @@ export const getUpmConfigDir = async function (): Promise<string> {
dirPath = path.join(process.env.ALLUSERSPROFILE, systemUserSubPath);
}
}
if (dirPath === undefined)
throw new Error("Could not resolve upm-config dir-path");
return dirPath;
};

Expand Down

0 comments on commit 9108970

Please sign in to comment.