Skip to content

Commit

Permalink
fixing production app path for mac and linux
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingalike committed Jan 19, 2021
1 parent 16b74a6 commit f7ca816
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/services/wallet.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import lib from 'cardano-crypto.js'
const cmd = util.promisify(exec);

const isDevelopment = process.env.NODE_ENV !== 'production'
const appPath = path.resolve(process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + "/.local/share"), 'lift-wallet');
const walletPath = isDevelopment
? path.resolve(__dirname, '..', 'cardano', 'wallets')
: path.resolve(process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + "/.local/share"), 'lift-wallet', 'wallets');
: path.resolve(appPath , 'wallets');

const accountPrvFile = 'account.xprv';
const accountPubFile = 'account.xpub';
Expand All @@ -43,8 +44,13 @@ const rawTxFile = 'raw.tx';
const signedTxFile = 'signed.tx';

export async function setupWalletDir() {
if(!isDevelopment) {
if(!fs.existsSync(appPath)) {
fs.mkdirSync(appPath);
}
}

if(!fs.existsSync(walletPath)){
console.log(walletPath)
fs.mkdirSync(walletPath);
}

Expand Down Expand Up @@ -303,7 +309,7 @@ export async function sendTransaction(network, name, amount, toAddress, passphra
//submit transaction to dandelion
result.transactionId = await submitTransaction(network, signedtxContents);
}catch(err) {
console.log(err);
console.error(err);
if(err.response.data != undefined) {
console.log(err.response.data);
result.error = err.response.data;
Expand Down

0 comments on commit f7ca816

Please sign in to comment.