fix(settings): check for null pathToSave before to backup wallet
This commit is contained in:
parent
e966a80129
commit
d5a658e4c6
|
@ -145,13 +145,19 @@ export class SettingsView extends PureComponent<Props, State> {
|
|||
};
|
||||
|
||||
backupWalletDat = async () => {
|
||||
const zcashDir = isDev ? `${HOME_DIR}/.zcash/testnet3` : HOME_DIR;
|
||||
const walletDatPath = `${zcashDir}/wallet.dat`;
|
||||
const backupFileName = `zcash-wallet-backup-${dateFns.format(
|
||||
new Date(),
|
||||
'YYYY-MM-DD-mm-ss',
|
||||
)}.dat`;
|
||||
|
||||
electron.remote.dialog.showSaveDialog(
|
||||
{ defaultPath: backupFileName },
|
||||
async (pathToSave) => {
|
||||
if (!pathToSave) return;
|
||||
|
||||
const zcashDir = isDev ? `${HOME_DIR}/.zcash/testnet3` : HOME_DIR;
|
||||
const walletDatPath = `${zcashDir}/wallet.dat`;
|
||||
|
||||
const [cannotAccess] = await eres(promisify(fs.access)(walletDatPath));
|
||||
|
||||
/* eslint-disable no-alert */
|
||||
|
@ -162,9 +168,6 @@ export class SettingsView extends PureComponent<Props, State> {
|
|||
);
|
||||
}
|
||||
|
||||
electron.remote.dialog.showSaveDialog(
|
||||
{ defaultPath: backupFileName },
|
||||
async (pathToSave) => {
|
||||
const [error] = await eres(
|
||||
promisify(fs.copyFile)(walletDatPath, pathToSave),
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue