Add: Finish Unified Uninstall Script

This commit is contained in:
Brenden Harrell committed 2021-05-23 15:21:10 -05:00
1 parent 32eee83073
commit 987eb76023
2 files changed
+24 -7

No files matched your search

+3 -4
View File
@@ -1,6 +1,5 @@
const path = require("path");
const fs = require("fs");
const process = require("process");
const { exec } = require("child_process");
const os = require("os");
@@ -12,11 +11,11 @@ let name = dirs[dirs.length - 2];
// Windows Shortcuts
if (os.platform() == "win32") {
// Paths and Icon for Windows shortcuts
let target = path.join( process.cwd(), "launch-windows.bat");
let icon = path.join( process.cwd(), "superalgos.ico");
let target = path.join( __dirname, "launch-windows.bat");
let icon = path.join( __dirname, "superalgos.ico");
let shortcutPaths = [
path.join( os.homedir(), "Desktop", `${name}.lnk`),
path.join( os.homedir(), "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs", "Superalgos.lnk")
path.join( os.homedir(), "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs", `${name}.lnk`)
]
// Place Shortcuts using powershell
+21 -3
View File
@@ -5,12 +5,30 @@ const { exec } = require("child_process");
// Get the name of the main directory
let cwd = __dirname;
let dirs = cwd.split(path.sep);
let name = dirs[dirs.length - 2];
let name = dirs[dirs.length - 1];
// Windows Shortcuts
// Remove Windows Shortcuts
if (os.platform() == "win32") {
let desktop = path.join( os.homedir(), "Desktop", `${name}.lnk`)
let startMenu = path.join( os.homedir(), "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs", `${name}.lnk`)
// Linux Shortcuts
// Remove .desktop files
let command = `del "${desktop}" & del "${startMenu}"`
exec( command,
function ( error ){
if (error) {
console.log('');
console.log("There was an error uninstalling shortcuts: ");
console.log('');
console.log( error );
return;
} else {
console.log('');
console.log("Shortcuts have been uninstalled successfully.");
}
});
// Remove Linux Shortcuts
} else if (os.platform() == "linux") {
// Check for Ubuntu
let version = os.version();