feat: updates deno-commons-mod.ts
This commit is contained in:
@@ -238,7 +238,16 @@ export const log = new Logger();
|
|||||||
|
|
||||||
export function getHomeDir(): string | null {
|
export function getHomeDir(): string | null {
|
||||||
if (Deno.build.os === "windows") {
|
if (Deno.build.os === "windows") {
|
||||||
return Deno.env.get("USERPROFILE") || Deno.env.get("HOMEDRIVE") + Deno.env.get("HOMEPATH") || null;
|
const userProfile = Deno.env.get("USERPROFILE");
|
||||||
|
if (userProfile) {
|
||||||
|
return userProfile;
|
||||||
|
}
|
||||||
|
const homeDrive = Deno.env.get("HOMEDRIVE");
|
||||||
|
const homePath = Deno.env.get("HOMEPATH");
|
||||||
|
if (homeDrive && homePath) {
|
||||||
|
return homeDrive + homePath;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return Deno.env.get("HOME") || null;
|
return Deno.env.get("HOME") || null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user