Skip to content

Commit

Permalink
fix deleting items from launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Percslol committed Aug 18, 2024
1 parent 17be238 commit 4529fa6
Showing 1 changed file with 31 additions and 36 deletions.
67 changes: 31 additions & 36 deletions src/Launcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,45 +323,40 @@ const LauncherShortcut: Component<
}
contextmenu.addItem(
"Delete",
function () {
(async () => {
if (
anura.apps[app.package].source &&
anura.apps[app.package].source.includes("/fs")
) {
try {
const sh = new anura.fs.Shell();
const path = (app as ExternalApp).source.replace(
/^\/fs\//,
"",
);
await sh.rm(
path,
{
recursive: true,
},
function (err) {
if (err) throw err;
},
);
// FIXME: it doesnt get removed from the launcher
delete anura.apps[app.package];
// FIXME: DUMB HACK
location.reload();
} catch (e) {
console.error(e);
anura.dialog.alert(
"Could not delete app. Please try again later: " +
e,
);
}
} else {
console.error("App not found");
async () => {
if (
anura.apps[app.package].source &&
anura.apps[app.package].source.includes("/fs")
) {
try {
const sh = new anura.fs.Shell();
const path = (app as ExternalApp).source.replace(
/^\/fs\//,
"",
);
await sh.rm(
path,
{
recursive: true,
},
function (err) {
if (err) throw err;
},
);
delete anura.apps[app.package];
this.root.remove();
} catch (e) {
console.error(e);
anura.dialog.alert(
"App not found. Either it's a system app or something has gone terribly wrong.",
"Could not delete app. Please try again later: " + e,
);
}
})();
} else {
console.error("App not found");
anura.dialog.alert(
"App not found. Either it's a system app or something has gone terribly wrong.",
);
}
},
"delete",
);
Expand Down

0 comments on commit 4529fa6

Please sign in to comment.