Skip to content

Commit

Permalink
fix: set default cache dir by using __dirname (#158)
Browse files Browse the repository at this point in the history
* Add missing srcDir option

Fixes: #157
  • Loading branch information
ayushmanchhabra authored Apr 27, 2024
1 parent e5d6fb1 commit 601911f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import util from '../src/util.js';
* @property {"ia32" | "x64" | "arm64"} arch Target arch
* @property {string} downloadUrl Download server.
* @property {string} cacheDir Cache directory
* @property {string} srcDir Source directory
* @property {boolean} cache If false, remove cache and redownload.
* @property {boolean} ffmpeg If true, ffmpeg is not downloaded.
* @property {false | "gyp"} nativeAddon Rebuild native modules
Expand Down Expand Up @@ -67,7 +68,8 @@ export default async function parse(options) {
options.platform = options.platform || util.PLATFORM_KV[process.env.npm_config_nwjs_platform || process.env.NWJS_PLATFORM || process.platform];
options.arch = options.arch || util.ARCH_KV[process.env.npm_config_nwjs_process_arch || process.env.NWJS_ARCH || process.arch];
options.downloadUrl = options.downloadUrl || process.env.npm_config_nwjs_urlbase || process.env.NWJS_URLBASE || 'https://dl.nwjs.io';
options.cacheDir = options.npm_config_nwjs_urlbase || process.env.npm_config_nwjs_cache_dir || process.env.NWJS_CACHE_DIR || path.resolve('.', 'node_modules', 'nw');
options.cacheDir = options.npm_config_nwjs_urlbase || process.env.npm_config_nwjs_cache_dir || process.env.NWJS_CACHE_DIR || path.resolve(__dirname, '..');
options.srcDir = options.srcDir || process.cwd();
options.cache = options.cache || process.env.npm_config_nwjs_cache || process.env.NWJS_CACHE || true;
options.ffmpeg = options.ffmpeg || process.env.npm_config_nwjs_ffmpeg || process.env.NWJS_FFMPEG || false;
options.nativeAddon = options.nativeAddon || process.env.npm_config_nwjs_native_addon || process.env.NWJS_NATIVE_ADDON || false;
Expand Down

0 comments on commit 601911f

Please sign in to comment.