mirror of
https://github.com/shelljs/shelljs.git
synced 2026-01-25 16:07:37 +00:00
Use OS-agnostic filepath verification
This commit is contained in:
parent
bceb066c5c
commit
fd27d85317
@ -29,9 +29,11 @@ function _ln(options, source, dest) {
|
||||
}
|
||||
|
||||
source = String(source);
|
||||
var sourcePath = path.normalize(source).replace(RegExp(path.sep + '$'), '');
|
||||
var isAbsolute = (path.resolve(source) === sourcePath);
|
||||
dest = path.resolve(process.cwd(), String(dest));
|
||||
|
||||
if (!fs.existsSync(source) && !path.isAbsolute(source) && !fs.existsSync(path.dirname(dest) + '/' + source)) {
|
||||
if ((isAbsolute && !fs.existsSync(sourcePath)) || !fs.existsSync(path.resolve(process.cwd(), path.dirname(dest), source))) {
|
||||
common.error('Source file does not exist', true);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user