Skip to content

Commit

Permalink
refactor ~ (OSPaths) minor revision for correctness and conformity
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Aug 1, 2022
1 parent 0d407d5 commit 3066f1a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lib/OSPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,20 @@ function Adapt(adapter_: Platform.Adapter): { readonly OSPaths: OSPaths } {
}

function posix() {
const fallback = '/tmp';
const fallback = '/tmp'; // or '/var/tmp'
const priorityList = [
typeof os.tmpdir === 'function' ? os.tmpdir() : void 0,
env.get('TMPDIR'),
env.get('TEMP'),
env.get('TMP'),
// '/var/tmp'
];
return normalizePath(priorityList.find((v) => !isEmpty(v))) || fallback;
}

function windows() {
const fallback = 'C:\\Temp';
const fallback = 'C:\\Temp'; // or 'C:\\Windows\\Temp'
const priorityListLazy = [
os.tmpdir,
typeof os.tmpdir === 'function' ? os.tmpdir : () => void 0,
() => env.get('TEMP'),
() => env.get('TMP'),
() => joinPathToBase(env.get('LOCALAPPDATA'), ['Temp']),
Expand Down

0 comments on commit 3066f1a

Please sign in to comment.