mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Fix function names - consistent with convention
This commit is contained in:
@@ -4,19 +4,17 @@ ipc = require 'ipc'
|
||||
|
||||
module.exports =
|
||||
class AtomPortable
|
||||
@portableAtomHomePath: ->
|
||||
@getPortableAtomHomePath: ->
|
||||
execDirectoryPath = path.dirname(process.execPath)
|
||||
return path.join(execDirectoryPath, '..', '.atom')
|
||||
|
||||
@setPortable: (existingAtomHome) ->
|
||||
fs.copySync(existingAtomHome, @portableAtomHomePath())
|
||||
fs.copySync(existingAtomHome, @getPortableAtomHomePath())
|
||||
|
||||
@isPortableInstall: (platform, environmentAtomHome) ->
|
||||
return false unless platform is 'win32'
|
||||
return false if environmentAtomHome
|
||||
|
||||
return false if not fs.existsSync(@portableAtomHomePath())
|
||||
|
||||
return false if not fs.existsSync(@getPortableAtomHomePath())
|
||||
# currently checking only that the directory exists and is writable,
|
||||
# probably want to do some integrity checks on contents in future
|
||||
return @portableAtomHomePathWritable()
|
||||
@@ -25,13 +23,13 @@ class AtomPortable
|
||||
writable = false
|
||||
message = ""
|
||||
try
|
||||
writePermissionTestFile = path.join(@portableAtomHomePath(), "write.test")
|
||||
writePermissionTestFile = path.join(@getPortableAtomHomePath(), "write.test")
|
||||
fs.writeFileSync(writePermissionTestFile, "test") if not fs.existsSync(writePermissionTestFile)
|
||||
fs.removeSync(writePermissionTestFile)
|
||||
writable = true
|
||||
catch error
|
||||
message = "Failed to use portable Atom home directory. Using the default instead."
|
||||
message = "Portable Atom home directory (#{@portableAtomHomePath()}) is not writable. Using the default instead." if error.code == "EPERM"
|
||||
message = "Portable Atom home directory (#{@getPortableAtomHomePath()}) is not writable. Using the default instead." if error.code == "EPERM"
|
||||
|
||||
ipc.on 'check-portable-home-writable', (event, arg) ->
|
||||
event.sender.send 'check-portable-home-writable-response', {writable, message}
|
||||
|
||||
@@ -62,9 +62,9 @@ setupAtomHome = (args) ->
|
||||
atomHome = path.join(app.getHomeDir(), '.atom')
|
||||
AtomPortable = require './atom-portable'
|
||||
AtomPortable.setPortable(atomHome) if not AtomPortable.isPortableInstall(process.platform, process.env.ATOM_HOME) and args.setPortable
|
||||
atomHome = AtomPortable.portableAtomHomePath() if AtomPortable.isPortableInstall process.platform, process.env.ATOM_HOME
|
||||
atomHome = fs.realpathSync(atomHome)
|
||||
fs.statSync(atomHome)
|
||||
atomHome = AtomPortable.getPortableAtomHomePath() if AtomPortable.isPortableInstall(process.platform, process.env.ATOM_HOME)
|
||||
try
|
||||
atomHome = fs.realpathSync(atomHome)
|
||||
|
||||
process.env.ATOM_HOME = atomHome
|
||||
|
||||
|
||||
Reference in New Issue
Block a user