Added command line parameter to set portable

If parameter included, home directory will be copied to the portable
location to make this a portable install
This commit is contained in:
Dave Rael
2015-10-13 05:21:54 -06:00
parent 28c322a4cf
commit 4312f76ed7
3 changed files with 29 additions and 3 deletions

View File

@@ -4,7 +4,26 @@ temp = require "temp"
rimraf = require "rimraf"
AtomPortable = require "../src/browser/atom-portable"
describe "Portable Mode", ->
describe "Set Portable Mode", ->
portableAtomHomePath = path.join(path.dirname(process.execPath), "../.atom").toString()
portableAtomHomeNaturallyExists = fs.existsSync(portableAtomHomePath)
portableAtomHomeBackupPath = portableAtomHomePath + ".temp"
beforeEach ->
fs.renameSync(portableAtomHomePath, portableAtomHomeBackupPath) if fs.existsSync(portableAtomHomePath)
afterEach ->
if portableAtomHomeNaturallyExists
fs.renameSync(portableAtomHomeBackupPath, portableAtomHomePath) if not fs.existsSync(portableAtomHomePath)
else
rimraf.sync(portableAtomHomePath) if fs.existsSync(portableAtomHomePath)
rimraf.sync(portableAtomHomeBackupPath) if fs.existsSync(portableAtomHomeBackupPath)
it "creates portable home directory", ->
AtomPortable.setPortable(process.env.ATOM_HOME)
expect(fs.existsSync(portableAtomHomePath)).toBe true
describe "Check for Portable Mode", ->
describe "Windows", ->
platform = "win32"