Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gabaldon committed Mar 18, 2024
1 parent 2de2cc6 commit 439ef10
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ async function createWindow() {
{ label: 'Cut', accelerator: 'CmdOrCtrl+X', role: 'cut' },
{ label: 'Copy', accelerator: 'CmdOrCtrl+C', role: 'copy' },
{ label: 'Paste', accelerator: 'CmdOrCtrl+V', role: 'paste' },
{
label: 'Clean Data & Relaunch',
click: () => {
walletManager.clearWalletFiles()
win.webContents.send(SHUTDOWN)
actions.relaunch()
},
},
],
},
])
Expand Down
17 changes: 17 additions & 0 deletions electron/walletManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,23 @@ export class WalletManager {
}
}

public clearWalletFiles() {
if (fs.existsSync(SHEIKAH_PATH)) {
const entries = fs.readdirSync(SHEIKAH_PATH, { withFileTypes: true })

for (const entry of entries) {
const thisPath = path.resolve(SHEIKAH_PATH, entry.name)

if (fs.existsSync(thisPath)) {
entry.isDirectory() && this.clearWalletFiles()
entry.isFile() && fs.unlinkSync(thisPath)
}
}

fs.rmdirSync(SHEIKAH_PATH)
}
}

// Decompress downloaded wallet release on macOS
private async decompressDarwinWallet(file: string) {
try {
Expand Down

0 comments on commit 439ef10

Please sign in to comment.