@ms-cloudpack/config
Advanced tools
Comparing version 0.27.2 to 0.28.0
/** | ||
* Gets the path to the cache directory. | ||
* Get the cache path from user preferences if set. | ||
* Falls back to the default cache path `~/.cloudpack`. | ||
* | ||
* NOTE: If a session object is available, you should use `session.cachePath` instead. | ||
* | ||
* @param overridePath If set, this path (probably from a CLI option) will be used instead | ||
* of the path from preferences. | ||
*/ | ||
export declare function getCachePath(): string; | ||
export declare function getCachePath(overridePath?: string): Promise<string>; | ||
/** | ||
@@ -6,0 +12,0 @@ * Gets the path to the app's local cache directory. |
import os from 'os'; | ||
import path from 'path'; | ||
import { readUserPreferences } from './readUserPreferences.js'; | ||
/** | ||
* Gets the path to the cache directory. | ||
* Get the cache path from user preferences if set. | ||
* Falls back to the default cache path `~/.cloudpack`. | ||
* | ||
* NOTE: If a session object is available, you should use `session.cachePath` instead. | ||
* | ||
* @param overridePath If set, this path (probably from a CLI option) will be used instead | ||
* of the path from preferences. | ||
*/ | ||
export function getCachePath() { | ||
return path.join(os.homedir(), '.cloudpack'); | ||
export async function getCachePath(overridePath) { | ||
return overridePath || (await readUserPreferences())?.cachePath || path.join(os.homedir(), '.cloudpack'); | ||
} | ||
@@ -9,0 +16,0 @@ /** |
{ | ||
"name": "@ms-cloudpack/config", | ||
"version": "0.27.2", | ||
"version": "0.28.0", | ||
"description": "Configuration handling for cloudpack.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131623
1121