Skip to content

Commit 623caaf

Browse files
authored
Merge pull request atom#13605 from atom/dg-correct-portable-path-windows
Correct the portable path location on Windows
2 parents a0c6cd7 + 090bbf9 commit 623caaf

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

spec/atom-paths-spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import path from 'path'
88
const temp = require('temp').track()
99

1010
describe("AtomPaths", () => {
11-
const portableAtomHomePath = path.join(atomPaths.getAppDirectory(), '.atom')
12-
console.log(portableAtomHomePath)
11+
const portableAtomHomePath = path.join(atomPaths.getAppDirectory(), '..', '.atom')
1312

1413
afterEach(() => {
1514
atomPaths.setAtomHome(app.getPath('home'))

src/atom-paths.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const hasWriteAccess = (dir) => {
1717
const getAppDirectory = () => {
1818
switch (process.platform) {
1919
case 'darwin':
20-
return path.join(process.execPath.substring(0, process.execPath.indexOf('.app')), '..')
20+
return process.execPath.substring(0, process.execPath.indexOf('.app') + 4)
2121
case 'linux':
2222
case 'win32':
2323
return path.join(process.execPath, '..')
@@ -27,7 +27,7 @@ const getAppDirectory = () => {
2727
module.exports = {
2828
setAtomHome: (homePath) => {
2929
// When a read-writeable .atom folder exists above app use that
30-
const portableHomePath = path.join(getAppDirectory(), '.atom')
30+
const portableHomePath = path.join(getAppDirectory(), '..', '.atom')
3131
if (fs.existsSync(portableHomePath)) {
3232
if (hasWriteAccess(portableHomePath)) {
3333
process.env.ATOM_HOME = portableHomePath

0 commit comments

Comments
 (0)