Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0d2fa132
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,发现更多精彩内容 >>
提交
0d2fa132
编写于
11月 30, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
storage - fix smoketest
上级
b638c6bd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
72 addition
and
52 deletion
+72
-52
src/vs/platform/storage/node/storageMainService.ts
src/vs/platform/storage/node/storageMainService.ts
+72
-52
未找到文件。
src/vs/platform/storage/node/storageMainService.ts
浏览文件 @
0d2fa132
...
@@ -174,7 +174,13 @@ export class StorageMainService extends Disposable implements IStorageMainServic
...
@@ -174,7 +174,13 @@ export class StorageMainService extends Disposable implements IStorageMainServic
private
migrateGlobalStorage
():
Thenable
<
void
>
{
private
migrateGlobalStorage
():
Thenable
<
void
>
{
this
.
logService
.
info
(
'
[storage] migrating global storage from localStorage into SQLite
'
);
this
.
logService
.
info
(
'
[storage] migrating global storage from localStorage into SQLite
'
);
return
new
Promise
((
resolve
,
reject
)
=>
{
const
localStorageDBBackup
=
join
(
this
.
environmentService
.
userDataPath
,
'
Local Storage
'
,
'
file__0.localstorage.vscmig
'
);
return
exists
(
localStorageDBBackup
).
then
(
exists
=>
{
if
(
!
exists
)
{
return
Promise
.
resolve
();
// return if there is no DB to migrate from
}
return
readdir
(
this
.
environmentService
.
extensionsPath
).
then
(
extensions
=>
{
return
readdir
(
this
.
environmentService
.
extensionsPath
).
then
(
extensions
=>
{
const
supportedKeys
=
new
Map
<
string
,
string
>
();
const
supportedKeys
=
new
Map
<
string
,
string
>
();
[
[
...
@@ -246,79 +252,93 @@ export class StorageMainService extends Disposable implements IStorageMainServic
...
@@ -246,79 +252,93 @@ export class StorageMainService extends Disposable implements IStorageMainServic
}
}
});
});
const
handleSuffixKey
=
(
row
,
key
:
string
,
suffix
:
string
)
=>
{
return
import
(
'
vscode-sqlite3
'
).
then
(
sqlite3
=>
{
if
(
endsWith
(
key
,
suffix
.
toLowerCase
()))
{
const
value
:
string
=
row
.
value
.
toString
(
'
utf16le
'
);
const
normalizedKey
=
key
.
substring
(
0
,
key
.
length
-
suffix
.
length
)
+
suffix
;
this
.
store
(
normalizedKey
,
value
);
return
new
Promise
((
resolve
,
reject
)
=>
{
const
handleSuffixKey
=
(
row
,
key
:
string
,
suffix
:
string
)
=>
{
if
(
endsWith
(
key
,
suffix
.
toLowerCase
()))
{
const
value
:
string
=
row
.
value
.
toString
(
'
utf16le
'
);
const
normalizedKey
=
key
.
substring
(
0
,
key
.
length
-
suffix
.
length
)
+
suffix
;
return
true
;
this
.
store
(
normalizedKey
,
value
);
}
return
fals
e
;
return
tru
e
;
};
}
return
import
(
'
vscode-sqlite3
'
).
then
(
sqlite3
=>
{
return
false
;
const
localStorageDBBackup
=
join
(
this
.
environmentService
.
userDataPath
,
'
Local Storage
'
,
'
file__0.localstorage.vscmig
'
);
};
const
db
:
Database
=
new
(
sqlite3
.
Database
)(
localStorageDBBackup
,
error
=>
{
if
(
error
)
{
return
db
?
db
.
close
(()
=>
reject
(
error
))
:
reject
(
error
);
}
db
.
all
(
'
SELECT key, value FROM ItemTable
'
,
(
error
,
rows
)
=>
{
const
db
:
Database
=
new
(
sqlite3
.
Database
)(
localStorageDBBackup
,
error
=>
{
if
(
error
)
{
if
(
error
)
{
return
db
.
close
(()
=>
reject
(
error
));
if
(
db
)
{
db
.
close
();
}
return
reject
(
error
);
}
}
rows
.
forEach
(
row
=>
{
db
.
all
(
'
SELECT key, value FROM ItemTable
'
,
(
error
,
rows
)
=>
{
let
key
:
string
=
row
.
key
;
if
(
error
)
{
if
(
key
.
indexOf
(
'
storage://global/
'
)
!==
0
)
{
db
.
close
();
return
;
// not a global key
return
reject
(
error
);
}
}
// convert storage://global/colorthemedata => colorthemedata
try
{
key
=
key
.
substr
(
'
storage://global/
'
.
length
);
rows
.
forEach
(
row
=>
{
let
key
:
string
=
row
.
key
;
if
(
key
.
indexOf
(
'
storage://global/
'
)
!==
0
)
{
return
;
// not a global key
}
const
supportedKey
=
supportedKeys
.
get
(
key
);
// convert storage://global/colorthemedata => colorthemedata
if
(
supportedKey
)
{
key
=
key
.
substr
(
'
storage://global/
'
.
length
);
const
value
:
string
=
row
.
value
.
toString
(
'
utf16le
'
);
this
.
store
(
supportedKey
,
value
);
const
supportedKey
=
supportedKeys
.
get
(
key
);
}
if
(
supportedKey
)
{
const
value
:
string
=
row
.
value
.
toString
(
'
utf16le
'
);
// dynamic values
this
.
store
(
supportedKey
,
value
);
else
if
(
}
endsWith
(
key
,
'
.hidden
'
)
||
startsWith
(
key
,
'
experiments.
'
)
)
{
const
value
:
string
=
row
.
value
.
toString
(
'
utf16le
'
);
this
.
store
(
key
,
value
);
// dynamic values
}
else
if
(
endsWith
(
key
,
'
.hidden
'
)
||
startsWith
(
key
,
'
experiments.
'
)
)
{
const
value
:
string
=
row
.
value
.
toString
(
'
utf16le
'
);
// fix lowercased ".sessionCount"
this
.
store
(
key
,
value
);
else
if
(
handleSuffixKey
(
row
,
key
,
'
.sessionCount
'
))
{
}
}
// fix lowercased ".lastSessionDate
"
// fix lowercased ".sessionCount
"
else
if
(
handleSuffixKey
(
row
,
key
,
'
.lastSessionDate
'
))
{
}
else
if
(
handleSuffixKey
(
row
,
key
,
'
.sessionCount
'
))
{
}
// fix lowercased ".skipVersion
"
// fix lowercased ".lastSessionDate
"
else
if
(
handleSuffixKey
(
row
,
key
,
'
.skipVersion
'
))
{
}
else
if
(
handleSuffixKey
(
row
,
key
,
'
.lastSessionDate
'
))
{
}
// fix lowercased ".isCandidate
"
// fix lowercased ".skipVersion
"
else
if
(
handleSuffixKey
(
row
,
key
,
'
.isCandidate
'
))
{
}
else
if
(
handleSuffixKey
(
row
,
key
,
'
.skipVersion
'
))
{
}
// fix lowercased ".editedCount
"
// fix lowercased ".isCandidate
"
else
if
(
handleSuffixKey
(
row
,
key
,
'
.editedCount
'
))
{
}
else
if
(
handleSuffixKey
(
row
,
key
,
'
.isCandidate
'
))
{
}
// fix lowercased ".editedDate"
// fix lowercased ".editedCount"
else
if
(
handleSuffixKey
(
row
,
key
,
'
.editedDate
'
))
{
}
else
if
(
handleSuffixKey
(
row
,
key
,
'
.editedCount
'
))
{
}
});
db
.
close
();
// fix lowercased ".editedDate"
else
if
(
handleSuffixKey
(
row
,
key
,
'
.editedDate
'
))
{
}
});
resolve
();
db
.
close
();
}
catch
(
error
)
{
db
.
close
();
return
reject
(
error
);
}
resolve
();
});
});
});
});
});
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录