fs-extra-async
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -0,1 +1,2 @@ | ||
'use strict'; | ||
var fs = require('fs'); | ||
@@ -2,0 +3,0 @@ var fsExtra = require('./index.js'); |
'use strict'; | ||
var path; | ||
var etcPath; | ||
var osHomedir; | ||
var osHomedir = require('os-homedir'); | ||
var gitPath; | ||
function posix(file) { | ||
function win32(file) { | ||
if(typeof file !== 'string') { | ||
return; | ||
} | ||
if(/^~\//.test(file)) { | ||
if(/^~/.test(file)) { | ||
// 处理linux风格的home路径 | ||
file = path.join(osHomedir(), file.slice(2)); | ||
file = path.join(osHomedir(), file.slice(1)); | ||
} else if('/etc/protocols' === file) { | ||
@@ -23,5 +23,16 @@ file = path.join(etcPath, 'protocol'); | ||
} | ||
function posix(file) { | ||
if(typeof file !== 'string') { | ||
return; | ||
} | ||
if(/^~/.test(file)) { | ||
// 处理linux风格的home路径 | ||
file = path.join(osHomedir(), file.slice(1)); | ||
} | ||
return file; | ||
} | ||
if(process.platform === 'win32') { | ||
path = require('path').win32; | ||
osHomedir = require('os-homedir'); | ||
etcPath = path.join(process.env.windir, 'System32/drivers/etc'); | ||
@@ -33,7 +44,6 @@ try { | ||
} | ||
module.exports = win32; | ||
} else { | ||
path = require('path').posix; | ||
module.exports = posix; | ||
} else { | ||
module.exports = function() { | ||
return; | ||
}; | ||
} |
@@ -56,3 +56,3 @@ { | ||
}, | ||
"version": "2.0.0" | ||
"version": "2.0.1" | ||
} |
9589
122