Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bd799550
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,发现更多精彩内容 >>
提交
bd799550
编写于
6月 13, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
portable mode
上级
d631cb80
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
106 addition
and
12 deletion
+106
-12
src/cli.js
src/cli.js
+31
-0
src/main.js
src/main.js
+43
-10
src/vs/platform/environment/node/environmentService.ts
src/vs/platform/environment/node/environmentService.ts
+31
-2
src/vs/platform/node/product.ts
src/vs/platform/node/product.ts
+1
-0
未找到文件。
src/cli.js
浏览文件 @
bd799550
...
...
@@ -3,6 +3,37 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Error
.
stackTraceLimit
=
100
;
// increase number of stack frames (from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
const
fs
=
require
(
'
fs
'
);
const
path
=
require
(
'
path
'
);
const
product
=
require
(
'
../product.json
'
);
const
appRoot
=
path
.
dirname
(
__dirname
);
function
getApplicationPath
()
{
if
(
process
.
env
[
'
VSCODE_DEV
'
])
{
return
appRoot
;
}
else
if
(
process
.
platform
===
'
darwin
'
)
{
return
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
appRoot
)));
}
else
{
return
path
.
dirname
(
path
.
dirname
(
appRoot
));
}
}
function
getPortableDataPath
()
{
return
path
.
join
(
path
.
dirname
(
getApplicationPath
()),
product
.
portable
);
}
if
(
product
.
portable
)
{
const
portablePath
=
getPortableDataPath
();
try
{
fs
.
mkdirSync
(
portablePath
);
}
catch
(
err
)
{
if
(
err
.
code
!==
'
EEXIST
'
)
{
throw
err
;
}
}
const
tmpdir
=
path
.
join
(
portablePath
,
'
tmp
'
);
try
{
fs
.
mkdirSync
(
tmpdir
);
}
catch
(
err
)
{
if
(
err
.
code
!==
'
EEXIST
'
)
{
throw
err
;
}
}
process
.
env
[
process
.
platform
===
'
win32
'
?
'
TEMP
'
:
'
TMPDIR
'
]
=
tmpdir
;
}
//#region Add support for using node_modules.asar
(
function
()
{
const
path
=
require
(
'
path
'
);
...
...
src/main.js
浏览文件 @
bd799550
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
le
t
perf
=
require
(
'
./vs/base/common/performance
'
);
cons
t
perf
=
require
(
'
./vs/base/common/performance
'
);
perf
.
mark
(
'
main:started
'
);
// Perf measurements
...
...
@@ -12,6 +12,35 @@ global.perfStartTime = Date.now();
Error
.
stackTraceLimit
=
100
;
// increase number of stack frames (from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
const
fs
=
require
(
'
fs
'
);
const
path
=
require
(
'
path
'
);
const
product
=
require
(
'
../product.json
'
);
const
appRoot
=
path
.
dirname
(
__dirname
);
function
getApplicationPath
()
{
if
(
process
.
env
[
'
VSCODE_DEV
'
])
{
return
appRoot
;
}
else
if
(
process
.
platform
===
'
darwin
'
)
{
return
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
appRoot
)));
}
else
{
return
path
.
dirname
(
path
.
dirname
(
appRoot
));
}
}
function
getPortableDataPath
()
{
return
path
.
join
(
path
.
dirname
(
getApplicationPath
()),
product
.
portable
);
}
if
(
product
.
portable
)
{
const
portablePath
=
getPortableDataPath
();
try
{
fs
.
mkdirSync
(
portablePath
);
}
catch
(
err
)
{
if
(
err
.
code
!==
'
EEXIST
'
)
{
throw
err
;
}
}
const
tmpdir
=
path
.
join
(
portablePath
,
'
tmp
'
);
try
{
fs
.
mkdirSync
(
tmpdir
);
}
catch
(
err
)
{
if
(
err
.
code
!==
'
EEXIST
'
)
{
throw
err
;
}
}
process
.
env
[
process
.
platform
===
'
win32
'
?
'
TEMP
'
:
'
TMPDIR
'
]
=
tmpdir
;
}
//#region Add support for using node_modules.asar
(
function
()
{
const
path
=
require
(
'
path
'
);
...
...
@@ -36,18 +65,15 @@ Error.stackTraceLimit = 100; // increase number of stack frames (from 10, https:
})();
//#endregion
le
t
app
=
require
(
'
electron
'
).
app
;
cons
t
app
=
require
(
'
electron
'
).
app
;
// TODO@Ben Electron 2.0.x: prevent localStorage migration from SQLite to LevelDB due to issues
app
.
commandLine
.
appendSwitch
(
'
disable-mojo-local-storage
'
);
let
fs
=
require
(
'
fs
'
);
let
path
=
require
(
'
path
'
);
let
minimist
=
require
(
'
minimist
'
);
let
paths
=
require
(
'
./paths
'
);
let
product
=
require
(
'
../product.json
'
);
const
minimist
=
require
(
'
minimist
'
);
const
paths
=
require
(
'
./paths
'
);
le
t
args
=
minimist
(
process
.
argv
,
{
cons
t
args
=
minimist
(
process
.
argv
,
{
string
:
[
'
user-data-dir
'
,
'
locale
'
,
...
...
@@ -350,9 +376,16 @@ function getNodeCachedDataDir() {
}
//#endregion
function
getUserDataPath
()
{
if
(
product
.
portable
)
{
return
path
.
join
(
getPortableDataPath
(),
'
user-data
'
);
}
return
path
.
resolve
(
args
[
'
user-data-dir
'
]
||
paths
.
getDefaultUserDataPath
(
process
.
platform
));
}
// Set userData path before app 'ready' event and call to process.chdir
let
userData
=
path
.
resolve
(
args
[
'
user-data-dir
'
]
||
paths
.
getDefaultUserDataPath
(
process
.
platform
));
app
.
setPath
(
'
userData
'
,
userData
);
app
.
setPath
(
'
userData
'
,
getUserDataPath
());
// Update cwd based on environment and platform
try
{
...
...
src/vs/platform/environment/node/environmentService.ts
浏览文件 @
bd799550
...
...
@@ -90,7 +90,24 @@ export class EnvironmentService implements IEnvironmentService {
get
userHome
():
string
{
return
os
.
homedir
();
}
@
memoize
get
userDataPath
():
string
{
return
parseUserDataDir
(
this
.
_args
,
process
);
}
private
get
appPath
():
string
{
if
(
process
.
env
[
'
VSCODE_DEV
'
])
{
return
this
.
appRoot
;
}
else
if
(
process
.
platform
===
'
darwin
'
)
{
return
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
this
.
appRoot
)));
}
else
{
return
path
.
dirname
(
path
.
dirname
(
this
.
appRoot
));
}
}
@
memoize
get
userDataPath
():
string
{
if
(
product
.
portable
)
{
return
path
.
join
(
path
.
dirname
(
this
.
appPath
),
product
.
portable
,
'
user-data
'
);
}
return
parseUserDataDir
(
this
.
_args
,
process
);
}
get
appNameLong
():
string
{
return
product
.
nameLong
;
}
...
...
@@ -127,7 +144,19 @@ export class EnvironmentService implements IEnvironmentService {
get
installSourcePath
():
string
{
return
path
.
join
(
this
.
userDataPath
,
'
installSource
'
);
}
@
memoize
get
extensionsPath
():
string
{
return
parsePathArg
(
this
.
_args
[
'
extensions-dir
'
],
process
)
||
process
.
env
[
'
VSCODE_EXTENSIONS
'
]
||
path
.
join
(
this
.
userHome
,
product
.
dataFolderName
,
'
extensions
'
);
}
get
extensionsPath
():
string
{
const
fromArgs
=
parsePathArg
(
this
.
_args
[
'
extensions-dir
'
],
process
);
if
(
fromArgs
)
{
return
fromArgs
;
}
else
if
(
process
.
env
[
'
VSCODE_EXTENSIONS
'
])
{
return
process
.
env
[
'
VSCODE_EXTENSIONS
'
];
}
else
if
(
product
.
portable
)
{
return
path
.
join
(
path
.
dirname
(
this
.
appPath
),
product
.
portable
,
'
extensions
'
);
}
else
{
return
path
.
join
(
this
.
userHome
,
product
.
dataFolderName
,
'
extensions
'
);
}
}
@
memoize
get
extensionDevelopmentPath
():
string
{
return
this
.
_args
.
extensionDevelopmentPath
?
path
.
normalize
(
this
.
_args
.
extensionDevelopmentPath
)
:
this
.
_args
.
extensionDevelopmentPath
;
}
...
...
src/vs/platform/node/product.ts
浏览文件 @
bd799550
...
...
@@ -73,6 +73,7 @@ export interface IProductConfiguration {
'
darwin
'
:
string
;
};
logUploaderUrl
:
string
;
portable
?:
string
;
}
export
interface
ISurveyData
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录