Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9cf442e4
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9cf442e4
编写于
11月 12, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null check zip
上级
3c2ed748
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
7 deletion
+14
-7
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+1
-0
src/vs/platform/node/zip.ts
src/vs/platform/node/zip.ts
+13
-7
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
9cf442e4
...
...
@@ -479,6 +479,7 @@
"./vs/platform/node/minimalTranslations.ts"
,
"./vs/platform/node/package.ts"
,
"./vs/platform/node/product.ts"
,
"./vs/platform/node/zip.ts"
,
"./vs/platform/notification/common/notification.ts"
,
"./vs/platform/notification/test/common/testNotificationService.ts"
,
"./vs/platform/opener/common/opener.ts"
,
...
...
src/vs/platform/node/zip.ts
浏览文件 @
9cf442e4
...
...
@@ -33,10 +33,10 @@ export type ExtractErrorType = 'CorruptZip' | 'Incomplete';
export
class
ExtractError
extends
Error
{
readonly
type
:
ExtractErrorType
;
readonly
type
?
:
ExtractErrorType
;
readonly
cause
:
Error
;
constructor
(
type
:
ExtractErrorType
,
cause
:
Error
)
{
constructor
(
type
:
ExtractErrorType
|
undefined
,
cause
:
Error
)
{
let
message
=
cause
.
message
;
switch
(
type
)
{
...
...
@@ -62,7 +62,7 @@ function toExtractError(err: Error): ExtractError {
return
err
;
}
let
type
:
ExtractErrorType
=
void
0
;
let
type
:
ExtractErrorType
|
undefined
=
void
0
;
if
(
/end of central directory record signature not found/
.
test
(
err
.
message
))
{
type
=
'
CorruptZip
'
;
...
...
@@ -94,7 +94,7 @@ function extractEntry(stream: Readable, fileName: string, mode: number, targetPa
try
{
istream
=
createWriteStream
(
targetFileName
,
{
mode
});
istream
.
once
(
'
close
'
,
()
=>
c
(
null
));
istream
.
once
(
'
close
'
,
()
=>
c
());
istream
.
once
(
'
error
'
,
e
);
stream
.
once
(
'
error
'
,
e
);
stream
.
pipe
(
istream
);
...
...
@@ -105,7 +105,7 @@ function extractEntry(stream: Readable, fileName: string, mode: number, targetPa
}
function
extractZip
(
zipfile
:
ZipFile
,
targetPath
:
string
,
options
:
IOptions
,
logService
:
ILogService
,
token
:
CancellationToken
):
Promise
<
void
>
{
let
last
=
createCancelablePromise
(()
=>
Promise
.
resolve
(
null
));
let
last
=
createCancelablePromise
<
void
>
(()
=>
Promise
.
resolve
(
));
let
extractedEntriesCount
=
0
;
once
(
token
.
onCancellationRequested
)(()
=>
{
...
...
@@ -129,7 +129,7 @@ function extractZip(zipfile: ZipFile, targetPath: string, options: IOptions, log
zipfile
.
once
(
'
error
'
,
e
);
zipfile
.
once
(
'
close
'
,
()
=>
last
.
then
(()
=>
{
if
(
token
.
isCancellationRequested
||
zipfile
.
entryCount
===
extractedEntriesCount
)
{
c
(
null
);
c
();
}
else
{
e
(
new
ExtractError
(
'
Incomplete
'
,
new
Error
(
nls
.
localize
(
'
incompleteExtract
'
,
"
Incomplete. Found {0} of {1} entries
"
,
extractedEntriesCount
,
zipfile
.
entryCount
))));
}
...
...
@@ -177,7 +177,13 @@ export interface IFile {
export
function
zip
(
zipPath
:
string
,
files
:
IFile
[]):
Promise
<
string
>
{
return
new
Promise
<
string
>
((
c
,
e
)
=>
{
const
zip
=
new
yazl
.
ZipFile
();
files
.
forEach
(
f
=>
f
.
contents
?
zip
.
addBuffer
(
typeof
f
.
contents
===
'
string
'
?
Buffer
.
from
(
f
.
contents
,
'
utf8
'
)
:
f
.
contents
,
f
.
path
)
:
zip
.
addFile
(
f
.
localPath
,
f
.
path
));
files
.
forEach
(
f
=>
{
if
(
f
.
contents
)
{
zip
.
addBuffer
(
typeof
f
.
contents
===
'
string
'
?
Buffer
.
from
(
f
.
contents
,
'
utf8
'
)
:
f
.
contents
,
f
.
path
);
}
else
if
(
f
.
localPath
)
{
zip
.
addFile
(
f
.
localPath
,
f
.
path
);
}
});
zip
.
end
();
const
zipStream
=
createWriteStream
(
zipPath
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录