mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-26 16:14:16 +03:00
Home directory is process.env.USERPROFILE on Windows.
This commit is contained in:
parent
640b6feb49
commit
0a561643a9
@ -134,6 +134,7 @@ describe "fs", ->
|
||||
|
||||
describe ".absolute(relativePath)", ->
|
||||
it "converts a leading ~ segment to the HOME directory", ->
|
||||
expect(fs.absolute('~')).toBe fs.realpathSync(process.env.HOME)
|
||||
expect(fs.absolute(path.join('~', 'does', 'not', 'exist'))).toBe path.join(process.env.HOME, 'does', 'not', 'exist')
|
||||
homeDir = atom.getHomeDirPath()
|
||||
expect(fs.absolute('~')).toBe fs.realpathSync(homeDir)
|
||||
expect(fs.absolute(path.join('~', 'does', 'not', 'exist'))).toBe path.join(homeDir, 'does', 'not', 'exist')
|
||||
expect(fs.absolute('~test')).toBe '~test'
|
||||
|
@ -13,10 +13,12 @@ fsExtensions =
|
||||
absolute: (relativePath) ->
|
||||
return null unless relativePath?
|
||||
|
||||
homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
|
||||
|
||||
if relativePath is '~'
|
||||
relativePath = process.env.HOME
|
||||
relativePath = homeDir
|
||||
else if relativePath.indexOf('~/') is 0
|
||||
relativePath = "#{process.env.HOME}#{relativePath.substring(1)}"
|
||||
relativePath = "#{homeDir}#{relativePath.substring(1)}"
|
||||
|
||||
try
|
||||
fs.realpathSync(relativePath)
|
||||
|
@ -14,6 +14,8 @@ module.exports = (grunt) ->
|
||||
rm 'atom-shell'
|
||||
|
||||
grunt.registerTask 'clean', 'Delete all the build files', ->
|
||||
homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
|
||||
|
||||
rm 'node_modules'
|
||||
rm path.join(process.env.HOME, '.atom', '.node-gyp')
|
||||
rm path.join(homeDir, '.atom', '.node-gyp')
|
||||
grunt.task.run('partial-clean')
|
||||
|
Loading…
Reference in New Issue
Block a user