From 4a8a741ef087e13c8471ff3463bb0558ba239969 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 21 Jul 2014 16:30:27 -0700 Subject: [PATCH] Write Atom.desktop file directly from template Previously this was written to resources/linux/Atom.desktop which would create issues when running `sudo script/grunt install` followed by `script/grunt mkdeb` --- build/tasks/install-task.coffee | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/build/tasks/install-task.coffee b/build/tasks/install-task.coffee index d3a3aa010..4ef52a40b 100644 --- a/build/tasks/install-task.coffee +++ b/build/tasks/install-task.coffee @@ -4,11 +4,6 @@ _ = require 'underscore-plus' fs = require 'fs-plus' runas = null -fillTemplate = (filePath, data) -> - template = _.template(String(fs.readFileSync(filePath + '.in'))) - filled = template(data) - fs.writeFileSync(filePath, filled) - module.exports = (grunt) -> {cp, mkdir, rm} = require('./task-helpers')(grunt) @@ -32,7 +27,6 @@ module.exports = (grunt) -> shareDir = path.join(installDir, 'share', 'atom') iconName = path.join(shareDir,'resources','app','resources','atom.png') - desktopFile = path.join('resources', 'linux', 'Atom.desktop') mkdir binDir cp 'atom.sh', path.join(binDir, 'atom') @@ -42,13 +36,17 @@ module.exports = (grunt) -> # Create Atom.desktop if installation not in temporary folder tmpDir = if process.env.TMPDIR? then process.env.TMPDIR else '/tmp' - desktopInstallFile = path.join(installDir,'share','applications','Atom.desktop') + desktopInstallFile = path.join(installDir, 'share', 'applications', 'Atom.desktop') if installDir.indexOf(tmpDir) isnt 0 mkdir path.dirname(desktopInstallFile) {description} = grunt.file.readJSON('package.json') installDir = path.join(installDir,'.') # To prevent "Exec=/usr/local//share/atom/atom" - fillTemplate(desktopFile, {description, installDir, iconName}) - cp desktopFile, desktopInstallFile + + desktopFile = path.join('resources', 'linux', 'Atom.desktop.in') + template = _.template(String(fs.readFileSync(desktopFile))) + filled = template({description, installDir, iconName}) + + grunt.file.write(desktopInstallFile, filled) # Create relative symbol link for apm. process.chdir(binDir)