@bemoje/path 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get the app data path, depending on the current OS (win, osx, linux).
|
|
3
3
|
*/
|
|
4
|
-
export declare function getAppDataPath(
|
|
4
|
+
export declare function getAppDataPath(author?: string, app?: string, ...subdirs: string[]): string;
|
|
5
5
|
//# sourceMappingURL=getAppDataPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAppDataPath.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/getAppDataPath.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"getAppDataPath.d.ts","sourceRoot":"","sources":["../../../../../packages/path/src/lib/getAppDataPath.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,UAiBjF"}
|
|
@@ -8,7 +8,7 @@ const os_2 = require("@bemoje/os");
|
|
|
8
8
|
/**
|
|
9
9
|
* Get the app data path, depending on the current OS (win, osx, linux).
|
|
10
10
|
*/
|
|
11
|
-
function getAppDataPath(
|
|
11
|
+
function getAppDataPath(author, app, ...subdirs) {
|
|
12
12
|
let appDataPath = process.env['APPDATA'];
|
|
13
13
|
if (!appDataPath) {
|
|
14
14
|
const OS = (0, os_2.getOS)();
|
|
@@ -25,11 +25,11 @@ function getAppDataPath(appName, ...subdirs) {
|
|
|
25
25
|
throw new Error('Could not find an appropriate app data path');
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
if (!
|
|
28
|
+
if (!author)
|
|
29
29
|
return appDataPath;
|
|
30
30
|
if (appDataPath === os_1.default.homedir())
|
|
31
|
-
|
|
32
|
-
return path_1.default.join(appDataPath,
|
|
31
|
+
author = '.' + author;
|
|
32
|
+
return path_1.default.join(appDataPath, author, ...subdirs);
|
|
33
33
|
}
|
|
34
34
|
exports.getAppDataPath = getAppDataPath;
|
|
35
35
|
//# sourceMappingURL=getAppDataPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAppDataPath.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/getAppDataPath.ts"],"names":[],"mappings":";;;;AAAA,oDAAmB;AACnB,wDAAuB;AACvB,mCAAkC;AAElC;;GAEG;AACH,SAAgB,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"getAppDataPath.js","sourceRoot":"","sources":["../../../../../packages/path/src/lib/getAppDataPath.ts"],"names":[],"mappings":";;;;AAAA,oDAAmB;AACnB,wDAAuB;AACvB,mCAAkC;AAElC;;GAEG;AACH,SAAgB,cAAc,CAAC,MAAe,EAAE,GAAY,EAAE,GAAG,OAAiB;IAChF,IAAI,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACxC,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,EAAE,GAAG,IAAA,UAAK,GAAE,CAAA;QAClB,IAAI,EAAE,KAAK,SAAS,EAAE;YACpB,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;SAC5D;aAAM,IAAI,EAAE,KAAK,KAAK,EAAE;YACvB,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAA;SACxE;aAAM,IAAI,EAAE,KAAK,OAAO,EAAE;YACzB,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;SACjD;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;SAC/D;KACF;IACD,IAAI,CAAC,MAAM;QAAE,OAAO,WAAW,CAAA;IAC/B,IAAI,WAAW,KAAK,YAAE,CAAC,OAAO,EAAE;QAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAA;IACvD,OAAO,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAA;AACnD,CAAC;AAjBD,wCAiBC"}
|