fix .desktop + allow to turn this feature off

This commit is contained in:
azivner 2018-11-21 11:19:33 +01:00
parent 8ce3c1a480
commit 8159564885
2 changed files with 8 additions and 6 deletions

View File

@ -1,10 +1,11 @@
"use strict";
const path = require('path');
const {APP_PNG_ICON_DIR} = require("./resource_dir");
const {APP_PNG_ICON_DIR, ELECTRON_APP_ROOT_DIR} = require("./resource_dir");
const log = require("./log");
const os = require('os');
const fs = require('fs');
const config = require('./config');
const template = `[Desktop Entry]
Type=Application
@ -19,8 +20,8 @@ Terminal=false
* Installs .desktop icon into standard ~/.local/share/applications directory.
* We overwrite this file during every run as it might have been updated.
*/
async function installLocalAppIcon() {
if (["win32", "darwin"].includes(os.platform())) {
function installLocalAppIcon() {
if (["win32", "darwin"].includes(os.platform()) || (config.General && config.General.noDesktopIcon)) {
return;
}
@ -55,9 +56,7 @@ function escapePath(path) {
}
function getExePath() {
const appPath = require('electron').app.getAppPath();
return path.resolve(appPath, 'trilium');
return path.resolve(ELECTRON_APP_ROOT_DIR, 'trilium');
}
module.exports = {

View File

@ -4,6 +4,8 @@ const fs = require('fs');
const RESOURCE_DIR = path.resolve(__dirname, "../..");
// where "trilium" executable is
const ELECTRON_APP_ROOT_DIR = path.resolve(RESOURCE_DIR, "../..");
const DB_INIT_DIR = path.resolve(RESOURCE_DIR, "db");
const APP_PNG_ICON_DIR = path.resolve(RESOURCE_DIR, "src/public/images/app-icons/png");
@ -23,5 +25,6 @@ module.exports = {
RESOURCE_DIR,
MIGRATIONS_DIR,
DB_INIT_DIR,
ELECTRON_APP_ROOT_DIR,
APP_PNG_ICON_DIR
};