forked from mzehrer/node-7z
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from oskarlh/fix-directory-separators
Fix directory separator replacement on Windows
- Loading branch information
Showing
16 changed files
with
121 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,8 @@ | |
"Dannii Willis <[email protected]>", | ||
"redx25 <[email protected]>", | ||
"l. stubbs <[email protected]>", | ||
"František Gič <[email protected]>" | ||
"František Gič <[email protected]>", | ||
"Oskar Larsson Högfeldt <[email protected]>" | ||
], | ||
"license": "ISC", | ||
"bugs": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/*global describe, it */ | ||
'use strict'; | ||
var expect = require('chai').expect; | ||
var replaceNativeSeparator = require('../../util/replaceNativeSeparator'); | ||
var sep = require('path').sep; | ||
|
||
describe('Utility: `replaceNativeSeparator`', function () { | ||
|
||
it('should replace the native directory separator (' + sep + ')' + | ||
' with / and allows / in input', | ||
function (done) { | ||
[ | ||
['abc', 'abc'], | ||
['å/Ö', 'å/Ö'], | ||
['3' + sep + 'π' + sep + '1' + sep + '4.txt', '3/π/1/4.txt'], | ||
['abc/def' + sep + 'g', 'abc/def/g'], | ||
['directory' + sep + 'file', 'directory/file'], | ||
['a' + sep + 'b' + sep + 'c' + sep + 'd.txt', 'a/b/c/d.txt'], | ||
] | ||
.forEach(function (inputAndExpectedOutput) { | ||
var input = inputAndExpectedOutput[0]; | ||
var expectedOutput = inputAndExpectedOutput[1]; | ||
expect(replaceNativeSeparator(input)).to.eql(expectedOutput); | ||
}); | ||
done(); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
var nativeSeparator = require('path').sep; | ||
|
||
/** | ||
* @param {string} path A path with the native directory separator. | ||
* @return {string} A path with / for directory separator. | ||
*/ | ||
module.exports = function (path) { | ||
var result = path, next; | ||
while ((next = result.replace(nativeSeparator, '/')) !== result) { | ||
result = next; | ||
} | ||
return result; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters