Update app and tooling
This commit is contained in:
parent
3046531bdd
commit
e620ec7349
4950 changed files with 2975120 additions and 10 deletions
7
node_modules/os-paths/src/lib/index.d.ts
generated
vendored
Normal file
7
node_modules/os-paths/src/lib/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// # spell-checker:ignore rivy
|
||||
declare namespace OSPaths {
|
||||
function home(): string;
|
||||
function temp(): string;
|
||||
}
|
||||
declare function OSPaths(): typeof OSPaths;
|
||||
export = OSPaths;
|
||||
68
node_modules/os-paths/src/lib/index.js
generated
vendored
Normal file
68
node_modules/os-paths/src/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/* eslint-env es6, node */
|
||||
// # spell-checker:ignore HomeDrive HomePath LocalAppData UserProfile WinDir
|
||||
'use strict';
|
||||
|
||||
const os = require('os');
|
||||
const paths = require('path');
|
||||
|
||||
const isWinOS = /^win/i.test(process.platform);
|
||||
|
||||
function normalize_path(path) {
|
||||
return paths.normalize(paths.join(path, '.'));
|
||||
}
|
||||
|
||||
const base = () => {
|
||||
const { env } = process;
|
||||
|
||||
const object = {};
|
||||
|
||||
object.home = () => normalize_path(os.homedir ? os.homedir() : env.HOME);
|
||||
|
||||
object.temp = () => normalize_path(os.tmpdir ? os.tmpdir() : env.TMPDIR || env.TEMP || env.TMP);
|
||||
|
||||
return object;
|
||||
};
|
||||
|
||||
const windows = () => {
|
||||
const { env } = process;
|
||||
|
||||
const object = {};
|
||||
|
||||
object.home = () =>
|
||||
normalize_path(
|
||||
os.homedir
|
||||
? os.homedir()
|
||||
: env.USERPROFILE || paths.join(env.HOMEDRIVE, env.HOMEPATH) || env.HOME
|
||||
);
|
||||
|
||||
object.temp = () =>
|
||||
normalize_path(
|
||||
os.tmpdir
|
||||
? os.tmpdir()
|
||||
: env.TEMP ||
|
||||
env.TMP ||
|
||||
paths.join(env.LOCALAPPDATA || env.SystemRoot || env.windir, 'Temp')
|
||||
);
|
||||
|
||||
return object;
|
||||
};
|
||||
|
||||
class _OSPaths {
|
||||
constructor() {
|
||||
const OSPaths = function () {
|
||||
return new _OSPaths();
|
||||
};
|
||||
|
||||
this._fn = OSPaths;
|
||||
|
||||
// Connect to platform-specific API functions by extension
|
||||
const extension = isWinOS ? windows() : base();
|
||||
Object.keys(extension).forEach((key) => {
|
||||
this._fn[key] = extension[key];
|
||||
});
|
||||
|
||||
return this._fn;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new _OSPaths();
|
||||
Loading…
Add table
Add a link
Reference in a new issue