Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e6343028
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e6343028
编写于
5月 04, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
extract userData path computation
上级
e9f9aad3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
14 deletion
+54
-14
package.json
package.json
+1
-1
src/main.js
src/main.js
+5
-13
src/paths.js
src/paths.js
+32
-0
src/vs/base/node/paths.ts
src/vs/base/node/paths.ts
+16
-0
未找到文件。
package.json
浏览文件 @
e6343028
{
"name"
:
"Code"
,
"name"
:
"Code
- OSS
"
,
"version"
:
"1.1.0"
,
"electronVersion"
:
"0.37.6"
,
"author"
:
{
...
...
src/main.js
浏览文件 @
e6343028
...
...
@@ -9,6 +9,8 @@ global.vscodeStart = Date.now();
var
app
=
require
(
'
electron
'
).
app
;
var
fs
=
require
(
'
fs
'
);
var
path
=
require
(
'
path
'
);
var
paths
=
require
(
'
./paths
'
);
var
pkg
=
require
(
'
../package.json
'
);
function
stripComments
(
content
)
{
var
regexp
=
/
(
"
(?:[^\\\"]
*
(?:\\
.
)?)
*"
)
|
(
'
(?:[^\\\']
*
(?:\\
.
)?)
*'
)
|
(\/\*(?:\r?\n
|.
)
*
?\*\/)
|
(\/{2,}
.*
?(?:(?:\r?\n)
|$
))
/g
;
...
...
@@ -107,19 +109,9 @@ try {
console
.
error
(
err
);
}
// Set path according to being built or not
if
(
process
.
env
[
'
VSCODE_DEV
'
])
{
var
appData
=
app
.
getPath
(
'
appData
'
);
app
.
setPath
(
'
userData
'
,
path
.
join
(
appData
,
'
Code-Development
'
));
}
// Use custom user data dir if specified, required to run as root on Linux
var
args
=
process
.
argv
;
args
.
forEach
(
function
(
arg
)
{
if
(
arg
.
indexOf
(
'
--user-data-dir=
'
)
===
0
)
{
app
.
setPath
(
'
userData
'
,
arg
.
split
(
'
=
'
)[
1
]);
}
});
// Set userData path before app 'ready' event
var
userData
=
paths
.
getUserDataPath
(
process
.
platform
,
pkg
.
name
,
process
.
argv
);
app
.
setPath
(
'
userData
'
,
userData
);
// 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.
...
...
src/paths.js
0 → 100644
浏览文件 @
e6343028
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var
minimist
=
require
(
'
minimist
'
);
var
path
=
require
(
'
path
'
);
var
os
=
require
(
'
os
'
);
function
getAppDataPath
(
platform
)
{
switch
(
platform
)
{
case
'
win32
'
:
return
process
.
env
[
'
APPDATA
'
];
case
'
darwin
'
:
return
path
.
join
(
os
.
homedir
(),
'
Library
'
,
'
Application Support
'
);
case
'
linux
'
:
return
process
.
env
[
'
XDG_CONFIG_HOME
'
]
||
path
.
join
(
os
.
homedir
(),
'
.config
'
);
default
:
throw
new
Error
(
'
Platform not supported
'
);
}
}
function
getUserDataPath
(
platform
,
appName
,
args
)
{
var
argv
=
minimist
(
args
,
{
string
:
[
'
user-data-dir
'
]
});
var
userDataDir
=
argv
[
'
user-data-dir
'
];
var
appData
=
getAppDataPath
(
platform
);
if
(
userDataDir
)
{
return
userDataDir
;
}
return
path
.
join
(
appData
,
appName
);
}
exports
.
getAppDataPath
=
getAppDataPath
;
exports
.
getUserDataPath
=
getUserDataPath
;
\ No newline at end of file
src/vs/base/node/paths.ts
0 → 100644
浏览文件 @
e6343028
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
uri
from
'
vs/base/common/uri
'
;
interface
IPaths
{
getAppDataPath
(
platform
:
string
):
string
;
getUserDataPath
(
platform
:
string
,
appName
:
string
,
args
:
string
[]):
string
;
}
const
pathsPath
=
uri
.
parse
(
require
.
toUrl
(
'
paths
'
)).
fsPath
;
const
paths
=
require
.
__$__nodeRequire
<
IPaths
>
(
pathsPath
);
export
const
getAppDataPath
=
paths
.
getAppDataPath
;
export
const
getUserDataPath
=
paths
.
getUserDataPath
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录