Merge pull request #86 from electron/upgrade-pickle

Support multibyte characters in paths
This commit is contained in:
Kevin Sawicki 2016-08-29 11:32:43 -07:00 коммит произвёл GitHub
Родитель 9258576a99 d66f720441
Коммит 25658e1c89
8 изменённых файлов: 31 добавлений и 1 удалений

Просмотреть файл

@ -1,5 +1,11 @@
# Changes By Version
## Unreleased
### Fixed
- Multibyte characters in paths are now supported (#86)
## 0.12.2 - 2016-08-22
### Fixed

Просмотреть файл

@ -22,7 +22,7 @@
"clean": "grunt clean"
},
"dependencies": {
"chromium-pickle-js": "^0.1.0",
"chromium-pickle-js": "^0.2.0",
"commander": "^2.9.0",
"cuint": "^0.2.1",
"glob": "^6.0.4",

Просмотреть файл

@ -60,4 +60,15 @@ describe 'api', ->
asar.extractAll 'test/input/extractthis-unpack-dir.asar', 'tmp/extractthis-unpack-dir-api/'
compDirs 'tmp/extractthis-unpack-dir-api/', 'test/expected/extractthis', done
return
it 'should handle multibyte characters in paths', (done) ->
asar.createPackage 'test/input/packthis-unicode-path/', 'tmp/packthis-unicode-path.asar', (error) ->
done compFiles 'tmp/packthis-unicode-path.asar', 'test/expected/packthis-unicode-path.asar'
return
return
it 'should extract a text file from archive with multibyte characters in path', ->
actual = asar.extractFile('test/expected/packthis-unicode-path.asar', 'dir1/女の子.txt').toString 'utf8'
expected = fs.readFileSync 'test/input/packthis-unicode-path/dir1/女の子.txt', 'utf8'
# on windows replace crlf with lf
expected = expected.replace /\r\n/g, '\n' if os.platform() is 'win32'
assert.equal actual, expected
return

Просмотреть файл

@ -43,6 +43,16 @@ describe 'command line interface', ->
done assert.equal actual, expected
return
return
it 'should list files/dirs with multibyte characters in path', (done) ->
exec 'node bin/asar l test/expected/packthis-unicode-path.asar', (error, stdout, stderr) ->
actual = stdout
expected = fs.readFileSync('test/expected/packthis-unicode-path-filelist.txt', 'utf8') + '\n'
# on windows replace slashes with backslashes and crlf with lf
if os.platform() is 'win32'
expected = expected.replace(/\//g, '\\').replace(/\r\n/g, '\n')
done assert.equal actual, expected
return
return
# we need a way to set a path to extract to first, otherwise we pollute our project dir
# or we fake it by setting our cwd, but I don't like that
###

Просмотреть файл

@ -0,0 +1,3 @@
/dir1
/dir1/file1.txt
/dir1/女の子.txt

Двоичные данные
test/expected/packthis-unicode-path.asar Normal file

Двоичный файл не отображается.

Просмотреть файл

Просмотреть файл