mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 07:28:08 +03:00
Merge pull request #13605 from atom/dg-correct-portable-path-windows
Correct the portable path location on Windows
This commit is contained in:
commit
623caaf85d
@ -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'))
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user