Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b43c9501
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,发现更多精彩内容 >>
提交
b43c9501
编写于
4月 07, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
polish
上级
17d66171
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
17 deletion
+24
-17
src/main.js
src/main.js
+8
-5
src/vs/workbench/electron-main/env.ts
src/vs/workbench/electron-main/env.ts
+16
-12
未找到文件。
src/main.js
浏览文件 @
b43c9501
...
...
@@ -95,13 +95,16 @@ function getNLSConfiguration() {
return
{
locale
:
initialLocale
,
availableLanguages
:
{}
};
}
//
Change cwd if given via env variable
//
Update cwd based on environment and platform
try
{
if
(
process
.
env
.
VSCODE_CWD
)
{
if
(
process
.
platform
===
'
win32
'
)
{
process
.
env
.
VSCODE_CWD
=
process
.
cwd
();
// remember as environment variable
process
.
chdir
(
path
.
dirname
(
app
.
getPath
(
'
exe
'
)));
// always set application folder as cwd
}
else
if
(
process
.
env
.
VSCODE_CWD
)
{
process
.
chdir
(
process
.
env
.
VSCODE_CWD
);
}
}
catch
(
err
)
{
// noop
console
.
error
(
err
);
}
// Set path according to being built or not
...
...
@@ -121,12 +124,12 @@ args.forEach(function (arg) {
// Mac: when someone drops a file to the not-yet running VSCode, the open-file event fires even before
// the app-ready event. We listen very early for open-file and remember this upon startup as path to open.
global
.
macOpenFiles
=
[];
app
.
on
(
'
open-file
'
,
function
(
event
,
path
)
{
app
.
on
(
'
open-file
'
,
function
(
event
,
path
)
{
global
.
macOpenFiles
.
push
(
path
);
});
// Load our code once ready
app
.
once
(
'
ready
'
,
function
()
{
app
.
once
(
'
ready
'
,
function
()
{
var
nlsConfig
=
getNLSConfiguration
();
process
.
env
[
'
VSCODE_NLS_CONFIG
'
]
=
JSON
.
stringify
(
nlsConfig
);
require
(
'
./bootstrap-amd
'
).
bootstrap
(
'
vs/workbench/electron-main/main
'
);
...
...
src/vs/workbench/electron-main/env.ts
浏览文件 @
b43c9501
...
...
@@ -64,6 +64,8 @@ export const isBuilt = !process.env.VSCODE_DEV;
export
const
appRoot
=
path
.
dirname
(
uri
.
parse
(
require
.
toUrl
(
''
)).
fsPath
);
export
const
currentWorkingDirectory
=
process
.
env
.
VSCODE_CWD
||
process
.
cwd
();
let
productContents
:
IProductConfiguration
;
try
{
productContents
=
JSON
.
parse
(
fs
.
readFileSync
(
path
.
join
(
appRoot
,
'
product.json
'
),
'
utf8
'
));
...
...
@@ -280,7 +282,7 @@ function parsePathArguments(argv: string[], gotoLineMode?: boolean): string[] {
}
if
(
pathCandidate
)
{
pathCandidate
=
massag
ePath
(
pathCandidate
);
pathCandidate
=
prepar
ePath
(
pathCandidate
);
}
let
realPath
:
string
;
...
...
@@ -289,7 +291,7 @@ function parsePathArguments(argv: string[], gotoLineMode?: boolean): string[] {
}
catch
(
error
)
{
// in case of an error, assume the user wants to create this file
// if the path is relative, we join it to the cwd
realPath
=
path
.
normalize
(
path
.
isAbsolute
(
pathCandidate
)
?
pathCandidate
:
path
.
join
(
process
.
cwd
()
,
pathCandidate
));
realPath
=
path
.
normalize
(
path
.
isAbsolute
(
pathCandidate
)
?
pathCandidate
:
path
.
join
(
currentWorkingDirectory
,
pathCandidate
));
}
if
(
!
paths
.
isValidBasename
(
path
.
basename
(
realPath
)))
{
...
...
@@ -310,30 +312,32 @@ function parsePathArguments(argv: string[], gotoLineMode?: boolean): string[] {
);
}
function
massagePath
(
path
:
string
):
string
{
function
preparePath
(
p
:
string
):
string
{
// Trim trailing quotes
if
(
platform
.
isWindows
)
{
p
ath
=
strings
.
rtrim
(
path
,
'
"
'
);
// https://github.com/Microsoft/vscode/issues/1498
p
=
strings
.
rtrim
(
p
,
'
"
'
);
// https://github.com/Microsoft/vscode/issues/1498
}
// Trim whitespaces
p
ath
=
strings
.
trim
(
strings
.
trim
(
path
,
'
'
),
'
\t
'
);
p
=
strings
.
trim
(
strings
.
trim
(
p
,
'
'
),
'
\t
'
);
// Trim '.' chars on Windows to prevent invalid file names
if
(
platform
.
isWindows
)
{
path
=
strings
.
rtrim
(
resolvePath
(
path
),
'
.
'
);
// Resolve the path against cwd if it is relative
p
=
path
.
resolve
(
currentWorkingDirectory
,
p
);
// Trim trailing '.' chars on Windows to prevent invalid file names
p
=
strings
.
rtrim
(
p
,
'
.
'
);
}
return
p
ath
;
return
p
;
}
function
normalizePath
(
p
?:
string
):
string
{
return
p
?
path
.
normalize
(
p
)
:
p
;
}
function
resolvePath
(
p
?:
string
):
string
{
return
p
?
path
.
resolve
(
p
):
p
;
}
function
parseNumber
(
argv
:
string
[],
key
:
string
,
defaultValue
?:
number
,
fallbackValue
?:
number
):
number
{
let
value
:
number
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录