From 459309aa78220b23d78daecb61ef1092b3e749d4 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 21 Oct 2013 21:42:55 +0800 Subject: [PATCH] Do not use "/tmp" in scripts. --- Gruntfile.coffee | 4 +++- src/browser/atom-application.coffee | 3 ++- tasks/clean-task.coffee | 5 ++++- tasks/update-atom-shell-task.coffee | 7 ++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 89e11a1dd..056c2aa3d 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -1,5 +1,6 @@ fs = require 'fs' path = require 'path' +os = require 'os' fm = require 'json-front-matter' _ = require 'underscore-plus' @@ -9,7 +10,8 @@ packageJson = require './package.json' module.exports = (grunt) -> appName = 'Atom.app' [major, minor, patch] = packageJson.version.split('.') - buildDir = grunt.option('build-dir') ? '/tmp/atom-build' + tmpDir = if process.platform is 'win32' then os.tmpdir() else '/tmp' + buildDir = grunt.option('build-dir') ? path.join(tmpDir, 'atom-build') shellAppDir = path.join(buildDir, appName) contentsDir = path.join(shellAppDir, 'Contents') appDir = path.join(contentsDir, 'Resources', 'app') diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index d51dd5157..f708e8009 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -8,13 +8,14 @@ dialog = require 'dialog' fs = require 'fs' ipc = require 'ipc' path = require 'path' +os = require 'os' net = require 'net' shell = require 'shell' url = require 'url' {EventEmitter} = require 'events' _ = require 'underscore-plus' -socketPath = '/tmp/atom.sock' +socketPath = path.join(os.tmpdir(), 'atom.sock') # Private: The application's singleton class. # diff --git a/tasks/clean-task.coffee b/tasks/clean-task.coffee index 23b6da973..f50d7ecc7 100644 --- a/tasks/clean-task.coffee +++ b/tasks/clean-task.coffee @@ -1,13 +1,16 @@ path = require 'path' +os = require 'os' module.exports = (grunt) -> {rm} = require('./task-helpers')(grunt) grunt.registerTask 'partial-clean', 'Delete some of the build files', -> + tmpdir = if process.platform is 'win32' then os.tmpdir() else '/tmp' + rm grunt.config.get('atom.buildDir') rm require('../src/coffee-cache').cacheDir rm require('../src/less-compile-cache').cacheDir - rm '/tmp/atom-cached-atom-shells' + rm path.join(tmpdir, 'atom-cached-atom-shells') rm 'atom-shell' grunt.registerTask 'clean', 'Delete all the build files', -> diff --git a/tasks/update-atom-shell-task.coffee b/tasks/update-atom-shell-task.coffee index 9cbd0ea99..f42cef571 100644 --- a/tasks/update-atom-shell-task.coffee +++ b/tasks/update-atom-shell-task.coffee @@ -1,5 +1,6 @@ fs = require 'fs' path = require 'path' +os = require 'os' request = require 'request' formidable = require 'formidable' @@ -70,7 +71,11 @@ module.exports = (grunt) -> else null - getCachePath = (version) -> "/tmp/atom-cached-atom-shells/#{version}" + getTempDir = -> + if process.platform is 'win32' then os.tmpdir() else '/tmp' + + getCachePath = (version) -> + path.join(getTempDir(), 'atom-cached-atom-shells', version) isAtomShellVersionCached = (version) -> grunt.file.isFile(getCachePath(version), 'version')