Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
be413a0e
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,发现更多精彩内容 >>
提交
be413a0e
编写于
7月 20, 2017
作者:
J
João Moreno
提交者:
GitHub
7月 20, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #31120 from Microsoft/joao/win32-bump64
Windows: 32 to 64bit migration
上级
ae0bdbfd
23be721e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
130 addition
and
39 deletion
+130
-39
src/vs/platform/update/electron-main/auto-updater.win32.ts
src/vs/platform/update/electron-main/auto-updater.win32.ts
+80
-3
src/vs/platform/update/electron-main/updateFeedUrl.ts
src/vs/platform/update/electron-main/updateFeedUrl.ts
+42
-0
src/vs/platform/update/electron-main/updateService.ts
src/vs/platform/update/electron-main/updateService.ts
+8
-36
未找到文件。
src/vs/platform/update/electron-main/auto-updater.win32.ts
浏览文件 @
be413a0e
...
...
@@ -5,7 +5,9 @@
'
use strict
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
*
as
path
from
'
path
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
{
checksum
}
from
'
vs/base/node/crypto
'
;
import
{
EventEmitter
}
from
'
events
'
;
...
...
@@ -18,6 +20,9 @@ import { download, asJson } from 'vs/base/node/request';
import
{
IRequestService
}
from
'
vs/platform/request/node/request
'
;
import
{
IAutoUpdater
}
from
'
vs/platform/update/common/update
'
;
import
product
from
'
vs/platform/node/product
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/node/storage
'
;
import
{
dialog
}
from
'
electron
'
;
import
{
getUpdateFeedUrl
,
Win32UninstallPath
}
from
'
./updateFeedUrl
'
;
interface
IUpdate
{
url
:
string
;
...
...
@@ -28,20 +33,51 @@ interface IUpdate {
hash
:
string
;
}
const
eventNames
=
[
'
checking-for-update
'
,
'
update-not-available
'
,
'
update-available
'
,
'
update-downloaded
'
,
'
update-not-available
'
,
'
error
'
];
function
forwardEvent
(
eventName
:
string
,
source
:
EventEmitter
,
target
:
EventEmitter
):
void
{
source
.
on
(
eventName
,
(...
args
)
=>
target
.
emit
(
eventName
,
...
args
));
}
export
class
Win32AutoUpdaterImpl
extends
EventEmitter
implements
IAutoUpdater
{
private
autoUpdater64
:
Win32AutoUpdaterImpl
=
null
;
private
url
:
string
=
null
;
private
currentRequest
:
Promise
=
null
;
private
updatePackagePath
:
string
=
null
;
constructor
(
@
IRequestService
private
requestService
:
IRequestService
private
arch
:
string
,
private
channel
:
string
,
@
IRequestService
private
requestService
:
IRequestService
,
@
IStorageService
private
storageService
:
IStorageService
)
{
super
();
if
(
arch
===
'
ia32
'
)
{
if
(
this
.
storageService
.
getItem
(
'
autoUpdateWin32Prefer64Bits
'
,
false
))
{
this
.
autoUpdater64
=
this
.
create64BitAutoUpdater
();
}
}
}
get
cachePath
():
TPromise
<
string
>
{
const
result
=
path
.
join
(
tmpdir
(),
`vscode-update-
${
process
.
arch
}
`
);
private
create64BitAutoUpdater
():
Win32AutoUpdaterImpl
{
const
result
=
new
Win32AutoUpdaterImpl
(
'
x64
'
,
this
.
channel
,
this
.
requestService
,
this
.
storageService
);
result
.
setFeedURL
(
getUpdateFeedUrl
(
this
.
channel
,
'
x64
'
));
eventNames
.
forEach
(
e
=>
forwardEvent
(
e
,
result
,
this
));
return
result
;
}
private
get
cachePath
():
TPromise
<
string
>
{
const
result
=
path
.
join
(
tmpdir
(),
`vscode-update-
${
this
.
arch
}
`
);
return
new
TPromise
<
string
>
((
c
,
e
)
=>
mkdirp
(
result
,
null
,
err
=>
err
?
e
(
err
)
:
c
(
result
)));
}
...
...
@@ -50,6 +86,10 @@ export class Win32AutoUpdaterImpl extends EventEmitter implements IAutoUpdater {
}
checkForUpdates
():
void
{
if
(
this
.
autoUpdater64
)
{
return
this
.
autoUpdater64
.
checkForUpdates
();
}
if
(
!
this
.
url
)
{
throw
new
Error
(
'
No feed url set.
'
);
}
...
...
@@ -58,6 +98,27 @@ export class Win32AutoUpdaterImpl extends EventEmitter implements IAutoUpdater {
return
;
}
const
shouldPromptToMoveTo64Bits
=
this
.
arch
===
'
ia32
'
&&
this
.
storageService
.
getItem
(
'
autoUpdateWin32Propose64bits
'
,
true
);
if
(
shouldPromptToMoveTo64Bits
)
{
const
result
=
dialog
.
showMessageBox
({
title
:
product
.
nameLong
,
type
:
'
question
'
,
message
:
localize
(
'
propose64
'
,
"
{0} 64 bits for Windows is now available! Would you like to upgrade to the 64 bit version?
"
,
product
.
nameShort
),
buttons
:
[
localize
(
'
yes
'
,
"
Yes
"
),
localize
(
'
no
'
,
"
No
"
),
localize
(
'
neverAgain
'
,
"
Never Ask Again
"
)],
noLink
:
true
});
if
(
result
===
2
)
{
this
.
storageService
.
setItem
(
'
autoUpdateWin32Propose64bits
'
,
false
);
}
else
if
(
result
===
0
)
{
this
.
storageService
.
setItem
(
'
autoUpdateWin32Prefer64Bits
'
,
true
);
this
.
autoUpdater64
=
this
.
create64BitAutoUpdater
();
return
this
.
autoUpdater64
.
checkForUpdates
();
}
}
this
.
emit
(
'
checking-for-update
'
);
this
.
currentRequest
=
this
.
requestService
.
request
({
url
:
this
.
url
})
...
...
@@ -128,10 +189,26 @@ export class Win32AutoUpdaterImpl extends EventEmitter implements IAutoUpdater {
}
quitAndInstall
():
void
{
if
(
this
.
autoUpdater64
)
{
return
this
.
autoUpdater64
.
quitAndInstall
();
}
if
(
!
this
.
updatePackagePath
)
{
return
;
}
if
(
process
.
arch
===
'
ia32
'
&&
this
.
arch
===
'
x64
'
)
{
const
updatePackageContents
=
`@echo off\r\n"
${
Win32UninstallPath
}
" /silent\r\nstart /b "" "
${
this
.
updatePackagePath
}
" /silent /mergetasks=runcode,!desktopicon,!quicklaunchicon\r\n`
;
const
updatePackagePath
=
path
.
join
(
tmpdir
(),
'
vscode-update-32-to-64.bat
'
);
fs
.
writeFileSync
(
updatePackagePath
,
updatePackageContents
);
spawn
(
'
cmd
'
,
[
'
/c
'
,
'
call
'
,
updatePackagePath
],
{
detached
:
true
});
return
;
}
spawn
(
this
.
updatePackagePath
,
[
'
/silent
'
,
'
/mergetasks=runcode,!desktopicon,!quicklaunchicon
'
],
{
detached
:
true
,
stdio
:
[
'
ignore
'
,
'
ignore
'
,
'
ignore
'
]
...
...
src/vs/platform/update/electron-main/updateFeedUrl.ts
0 → 100644
浏览文件 @
be413a0e
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
*
as
fs
from
'
original-fs
'
;
import
*
as
path
from
'
path
'
;
import
product
from
'
vs/platform/node/product
'
;
export
const
Win32UninstallPath
=
path
.
join
(
path
.
dirname
(
process
.
execPath
),
'
unins000.exe
'
);
export
function
getUpdateFeedUrl
(
channel
:
string
,
arch
:
string
=
process
.
arch
):
string
{
if
(
!
channel
)
{
return
null
;
}
if
(
process
.
platform
===
'
win32
'
&&
!
fs
.
existsSync
(
Win32UninstallPath
))
{
return
null
;
}
if
(
!
product
.
updateUrl
||
!
product
.
commit
)
{
return
null
;
}
const
platform
=
getUpdatePlatform
(
arch
);
return
`
${
product
.
updateUrl
}
/api/update/
${
platform
}
/
${
channel
}
/
${
product
.
commit
}
`
;
}
function
getUpdatePlatform
(
arch
:
string
):
string
{
if
(
process
.
platform
===
'
linux
'
)
{
return
`linux-
${
arch
}
`
;
}
if
(
process
.
platform
===
'
win32
'
&&
arch
===
'
x64
'
)
{
return
'
win32-x64
'
;
}
return
process
.
platform
;
}
\ No newline at end of file
src/vs/platform/update/electron-main/updateService.ts
浏览文件 @
be413a0e
...
...
@@ -5,8 +5,6 @@
'
use strict
'
;
import
*
as
fs
from
'
original-fs
'
;
import
*
as
path
from
'
path
'
;
import
*
as
electron
from
'
electron
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
Event
,
{
Emitter
,
once
,
filterEvent
}
from
'
vs/base/common/event
'
;
...
...
@@ -22,6 +20,8 @@ import product from 'vs/platform/node/product';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IUpdateService
,
State
,
IAutoUpdater
,
IUpdate
,
IRawUpdate
}
from
'
vs/platform/update/common/update
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
getUpdateFeedUrl
}
from
'
./updateFeedUrl
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/node/storage
'
;
export
class
UpdateService
implements
IUpdateService
{
...
...
@@ -87,10 +87,13 @@ export class UpdateService implements IUpdateService {
@
IRequestService
requestService
:
IRequestService
,
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IStorageService
private
storageService
:
IStorageService
)
{
const
channel
=
this
.
getUpdateChannel
();
if
(
process
.
platform
===
'
win32
'
)
{
this
.
raw
=
new
Win32AutoUpdaterImpl
(
request
Service
);
this
.
raw
=
new
Win32AutoUpdaterImpl
(
process
.
arch
,
channel
,
requestService
,
storage
Service
);
}
else
if
(
process
.
platform
===
'
linux
'
)
{
this
.
raw
=
new
LinuxAutoUpdaterImpl
(
requestService
);
}
else
if
(
process
.
platform
===
'
darwin
'
)
{
...
...
@@ -99,8 +102,7 @@ export class UpdateService implements IUpdateService {
return
;
}
const
channel
=
this
.
getUpdateChannel
();
const
feedUrl
=
this
.
getUpdateFeedUrl
(
channel
);
const
feedUrl
=
getUpdateFeedUrl
(
channel
);
if
(
!
feedUrl
)
{
return
;
// updates not available
...
...
@@ -208,36 +210,6 @@ export class UpdateService implements IUpdateService {
return
channel
===
'
none
'
?
null
:
product
.
quality
;
}
private
getUpdateFeedUrl
(
channel
:
string
):
string
{
if
(
!
channel
)
{
return
null
;
}
if
(
process
.
platform
===
'
win32
'
&&
!
fs
.
existsSync
(
path
.
join
(
path
.
dirname
(
process
.
execPath
),
'
unins000.exe
'
)))
{
return
null
;
}
if
(
!
product
.
updateUrl
||
!
product
.
commit
)
{
return
null
;
}
const
platform
=
this
.
getUpdatePlatform
();
return
`
${
product
.
updateUrl
}
/api/update/
${
platform
}
/
${
channel
}
/
${
product
.
commit
}
`
;
}
private
getUpdatePlatform
():
string
{
if
(
process
.
platform
===
'
linux
'
)
{
return
`linux-
${
process
.
arch
}
`
;
}
if
(
process
.
platform
===
'
win32
'
&&
process
.
arch
===
'
x64
'
)
{
return
'
win32-x64
'
;
}
return
process
.
platform
;
}
quitAndInstall
():
TPromise
<
void
>
{
if
(
!
this
.
_availableUpdate
)
{
return
TPromise
.
as
(
null
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录