Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3c0abb8d
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,发现更多精彩内容 >>
提交
3c0abb8d
编写于
7月 03, 2018
作者:
D
Dirk Baeumer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support to regenerate nsl cache if corrupted.
上级
e79e446e
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
134 addition
and
55 deletion
+134
-55
src/bootstrap-amd.js
src/bootstrap-amd.js
+11
-2
src/main.js
src/main.js
+79
-45
src/vs/code/electron-browser/issue/issueReporter.js
src/vs/code/electron-browser/issue/issueReporter.js
+11
-2
src/vs/code/electron-browser/processExplorer/processExplorer.js
.../code/electron-browser/processExplorer/processExplorer.js
+11
-2
src/vs/code/electron-browser/sharedProcess/sharedProcess.js
src/vs/code/electron-browser/sharedProcess/sharedProcess.js
+11
-2
src/vs/workbench/electron-browser/bootstrap/index.js
src/vs/workbench/electron-browser/bootstrap/index.js
+11
-2
未找到文件。
src/bootstrap-amd.js
浏览文件 @
3c0abb8d
...
...
@@ -29,6 +29,8 @@ function readFile(file) {
});
}
const
writeFile
=
(
file
,
content
)
=>
new
Promise
((
c
,
e
)
=>
fs
.
writeFile
(
file
,
content
,
'
utf8
'
,
err
=>
err
?
e
(
err
)
:
c
()));
var
rawNlsConfig
=
process
.
env
[
'
VSCODE_NLS_CONFIG
'
];
var
nlsConfig
=
rawNlsConfig
?
JSON
.
parse
(
rawNlsConfig
)
:
{
availableLanguages
:
{}
};
...
...
@@ -46,8 +48,15 @@ if (nlsConfig._resolvedLanguagePackCoreLocation) {
let
json
=
JSON
.
parse
(
content
);
bundles
[
bundle
]
=
json
;
cb
(
undefined
,
json
);
})
.
catch
(
cb
);
}).
catch
((
error
)
=>
{
try
{
if
(
nlsConfig
.
_corruptedFile
)
{
writeFile
(
nlsConfig
.
_corruptedFile
,
'
corrupted
'
).
catch
(
function
(
error
)
{
console
.
error
(
error
);
});
}
}
finally
{
cb
(
error
,
undefined
);
}
});
};
}
...
...
src/main.js
浏览文件 @
3c0abb8d
...
...
@@ -123,6 +123,10 @@ const exists = file => new Promise(c => fs.exists(file, c));
const
readFile
=
file
=>
new
Promise
((
c
,
e
)
=>
fs
.
readFile
(
file
,
'
utf8
'
,
(
err
,
data
)
=>
err
?
e
(
err
)
:
c
(
data
)));
const
writeFile
=
(
file
,
content
)
=>
new
Promise
((
c
,
e
)
=>
fs
.
writeFile
(
file
,
content
,
'
utf8
'
,
err
=>
err
?
e
(
err
)
:
c
()));
const
touch
=
file
=>
new
Promise
((
c
,
e
)
=>
{
const
d
=
new
Date
();
fs
.
utimes
(
file
,
d
,
d
,
err
=>
err
?
e
(
err
)
:
c
());
});
const
lstat
=
file
=>
new
Promise
((
c
,
e
)
=>
fs
.
lstat
(
file
,
(
err
,
stats
)
=>
err
?
e
(
err
)
:
c
(
stats
)));
const
readdir
=
dir
=>
new
Promise
((
c
,
e
)
=>
fs
.
readdir
(
dir
,
(
err
,
files
)
=>
err
?
e
(
err
)
:
c
(
files
)));
const
rmdir
=
dir
=>
new
Promise
((
c
,
e
)
=>
fs
.
rmdir
(
dir
,
err
=>
err
?
e
(
err
)
:
c
(
undefined
)));
const
unlink
=
file
=>
new
Promise
((
c
,
e
)
=>
fs
.
unlink
(
file
,
err
=>
err
?
e
(
err
)
:
c
(
undefined
)));
function
mkdirp
(
dir
)
{
return
mkdir
(
dir
).
then
(
null
,
err
=>
{
...
...
@@ -138,6 +142,23 @@ function mkdirp(dir) {
});
}
function
rimraf
(
location
)
{
return
lstat
(
location
).
then
(
stat
=>
{
if
(
stat
.
isDirectory
()
&&
!
stat
.
isSymbolicLink
())
{
return
readdir
(
location
)
.
then
(
children
=>
Promise
.
all
(
children
.
map
(
child
=>
rimraf
(
path
.
join
(
location
,
child
)))))
.
then
(()
=>
rmdir
(
location
));
}
else
{
return
unlink
(
location
);
}
},
(
err
)
=>
{
if
(
err
.
code
===
'
ENOENT
'
)
{
return
void
0
;
}
throw
err
;
});
}
function
resolveJSFlags
(...
jsFlags
)
{
if
(
args
[
'
js-flags
'
])
{
...
...
@@ -267,14 +288,25 @@ function getNLSConfiguration(locale) {
let
cacheRoot
=
path
.
join
(
userData
,
'
clp
'
,
packId
);
let
coreLocation
=
path
.
join
(
cacheRoot
,
commit
);
let
translationsConfigFile
=
path
.
join
(
cacheRoot
,
'
tcf.json
'
);
let
corruptedFile
=
path
.
join
(
cacheRoot
,
'
corrupted.info
'
);
let
result
=
{
locale
:
initialLocale
,
availableLanguages
:
{
'
*
'
:
locale
},
_languagePackId
:
packId
,
_translationsConfigFile
:
translationsConfigFile
,
_cacheRoot
:
cacheRoot
,
_resolvedLanguagePackCoreLocation
:
coreLocation
_resolvedLanguagePackCoreLocation
:
coreLocation
,
_corruptedFile
:
corruptedFile
};
return
exists
(
corruptedFile
).
then
((
corrupted
)
=>
{
// The nls cache directory is corrupted.
let
toDelete
;
if
(
corrupted
)
{
toDelete
=
rimraf
(
cacheRoot
);
}
else
{
toDelete
=
Promise
.
resolve
(
undefined
);
}
return
toDelete
.
then
(()
=>
{
return
exists
(
coreLocation
).
then
((
fileExists
)
=>
{
if
(
fileExists
)
{
// We don't wait for this. No big harm if we can't touch
...
...
@@ -326,6 +358,8 @@ function getNLSConfiguration(locale) {
});
});
});
});
});
}
catch
(
err
)
{
console
.
error
(
'
Generating translation files failed.
'
,
err
);
return
defaultResult
(
locale
);
...
...
src/vs/code/electron-browser/issue/issueReporter.js
浏览文件 @
3c0abb8d
...
...
@@ -45,6 +45,8 @@ function readFile(file) {
});
}
const
writeFile
=
(
file
,
content
)
=>
new
Promise
((
c
,
e
)
=>
fs
.
writeFile
(
file
,
content
,
'
utf8
'
,
err
=>
err
?
e
(
err
)
:
c
()));
function
main
()
{
const
args
=
parseURLQueryArgs
();
const
configuration
=
JSON
.
parse
(
args
[
'
config
'
]
||
'
{}
'
)
||
{};
...
...
@@ -127,8 +129,15 @@ function main() {
let
json
=
JSON
.
parse
(
content
);
bundles
[
bundle
]
=
json
;
cb
(
undefined
,
json
);
})
.
catch
(
cb
);
}).
catch
((
error
)
=>
{
try
{
if
(
nlsConfig
.
_corruptedFile
)
{
writeFile
(
nlsConfig
.
_corruptedFile
,
'
corrupted
'
).
catch
(
function
(
error
)
{
console
.
error
(
error
);
});
}
}
finally
{
cb
(
error
,
undefined
);
}
});
};
}
...
...
src/vs/code/electron-browser/processExplorer/processExplorer.js
浏览文件 @
3c0abb8d
...
...
@@ -45,6 +45,8 @@ function readFile(file) {
});
}
const
writeFile
=
(
file
,
content
)
=>
new
Promise
((
c
,
e
)
=>
fs
.
writeFile
(
file
,
content
,
'
utf8
'
,
err
=>
err
?
e
(
err
)
:
c
()));
function
main
()
{
const
args
=
parseURLQueryArgs
();
const
configuration
=
JSON
.
parse
(
args
[
'
config
'
]
||
'
{}
'
)
||
{};
...
...
@@ -102,8 +104,15 @@ function main() {
let
json
=
JSON
.
parse
(
content
);
bundles
[
bundle
]
=
json
;
cb
(
undefined
,
json
);
})
.
catch
(
cb
);
}).
catch
((
error
)
=>
{
try
{
if
(
nlsConfig
.
_corruptedFile
)
{
writeFile
(
nlsConfig
.
_corruptedFile
,
'
corrupted
'
).
catch
(
function
(
error
)
{
console
.
error
(
error
);
});
}
}
finally
{
cb
(
error
,
undefined
);
}
});
};
}
...
...
src/vs/code/electron-browser/sharedProcess/sharedProcess.js
浏览文件 @
3c0abb8d
...
...
@@ -53,6 +53,8 @@ function readFile(file) {
});
}
const
writeFile
=
(
file
,
content
)
=>
new
Promise
((
c
,
e
)
=>
fs
.
writeFile
(
file
,
content
,
'
utf8
'
,
err
=>
err
?
e
(
err
)
:
c
()));
function
main
()
{
const
args
=
parseURLQueryArgs
();
const
configuration
=
JSON
.
parse
(
args
[
'
config
'
]
||
'
{}
'
)
||
{};
...
...
@@ -111,8 +113,15 @@ function main() {
let
json
=
JSON
.
parse
(
content
);
bundles
[
bundle
]
=
json
;
cb
(
undefined
,
json
);
})
.
catch
(
cb
);
}).
catch
((
error
)
=>
{
try
{
if
(
nlsConfig
.
_corruptedFile
)
{
writeFile
(
nlsConfig
.
_corruptedFile
,
'
corrupted
'
).
catch
(
function
(
error
)
{
console
.
error
(
error
);
});
}
}
finally
{
cb
(
error
,
undefined
);
}
});
};
}
...
...
src/vs/workbench/electron-browser/bootstrap/index.js
浏览文件 @
3c0abb8d
...
...
@@ -81,6 +81,8 @@ function readFile(file) {
});
}
const
writeFile
=
(
file
,
content
)
=>
new
Promise
((
c
,
e
)
=>
fs
.
writeFile
(
file
,
content
,
'
utf8
'
,
err
=>
err
?
e
(
err
)
:
c
()));
function
registerListeners
(
enableDeveloperTools
)
{
// Devtools & reload support
...
...
@@ -180,8 +182,15 @@ function main() {
let
json
=
JSON
.
parse
(
content
);
bundles
[
bundle
]
=
json
;
cb
(
undefined
,
json
);
})
.
catch
(
cb
);
}).
catch
((
error
)
=>
{
try
{
if
(
nlsConfig
.
_corruptedFile
)
{
writeFile
(
nlsConfig
.
_corruptedFile
,
'
corrupted
'
).
catch
(
function
(
error
)
{
console
.
error
(
error
);
});
}
}
finally
{
cb
(
error
,
undefined
);
}
});
};
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录