Files
kopia/app/public/utils.js
Jarek Kowalski c3ead4bc3e Kopia UI: added desktop app shell based on Electron that runs in the tray (#183)
* app: added desktop app shell based on Electron that runs in the tray, starts a background kopia server and allows access to the UI

* icons: updated icons for the app

* htmlui: flexible containers
2020-02-01 11:58:22 -08:00

42 lines
1.3 KiB
JavaScript

const path = require('path');
const isDev = require('electron-is-dev');
const osShortName = function() {
switch (process.platform) {
case "win32":
return "win"
case "darwin":
return "mac"
case "linux":
return "linux"
default:
return null
}
}();
module.exports = {
resourcesPath: function () {
if (isDev) {
return path.join(__dirname, "..", "resources", osShortName);
}
return process.resourcesPath;
},
defaultServerBinary: function () {
if (isDev) {
return {
"mac": path.join(__dirname, "..", "..", "dist", "kopia_darwin_amd64", "kopia"),
"win": path.join(__dirname, "..", "..", "dist", "kopia_windows_amd64", "kopia.exe"),
"linux": path.join(__dirname, "..", "..", "dist", "kopia_linux_amd64", "kopia"),
}[osShortName]
}
return {
"mac": path.join(process.resourcesPath, "server", "kopia"),
"win": path.join(process.resourcesPath, "server", "kopia.exe"),
"linux": path.join(process.resourcesPath, "server", "kopia"),
}[osShortName]
},
selectByOS: function (x) {
return x[osShortName]
},
}