diff --git a/spec/atom-paths-spec.js b/spec/atom-paths-spec.js index 4b1fc7902..3e2da4760 100644 --- a/spec/atom-paths-spec.js +++ b/spec/atom-paths-spec.js @@ -8,8 +8,7 @@ import path from 'path' const temp = require('temp').track() describe("AtomPaths", () => { - const portableAtomHomePath = path.join(atomPaths.getAppDirectory(), '.atom') - console.log(portableAtomHomePath) + const portableAtomHomePath = path.join(atomPaths.getAppDirectory(), '..', '.atom') afterEach(() => { atomPaths.setAtomHome(app.getPath('home')) diff --git a/src/atom-paths.js b/src/atom-paths.js index 6a5c107b3..39a768e91 100644 --- a/src/atom-paths.js +++ b/src/atom-paths.js @@ -17,7 +17,7 @@ const hasWriteAccess = (dir) => { const getAppDirectory = () => { switch (process.platform) { case 'darwin': - return path.join(process.execPath.substring(0, process.execPath.indexOf('.app')), '..') + return process.execPath.substring(0, process.execPath.indexOf('.app') + 4) case 'linux': case 'win32': return path.join(process.execPath, '..') @@ -27,7 +27,7 @@ const getAppDirectory = () => { module.exports = { setAtomHome: (homePath) => { // When a read-writeable .atom folder exists above app use that - const portableHomePath = path.join(getAppDirectory(), '.atom') + const portableHomePath = path.join(getAppDirectory(), '..', '.atom') if (fs.existsSync(portableHomePath)) { if (hasWriteAccess(portableHomePath)) { process.env.ATOM_HOME = portableHomePath