Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ded36ac6
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,发现更多精彩内容 >>
提交
ded36ac6
编写于
4月 17, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add mkdirp-option and honor it in the remote file service, #48062
上级
fc2609a5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
1 deletion
+32
-1
src/vs/platform/files/common/files.ts
src/vs/platform/files/common/files.ts
+5
-0
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
...ench/services/files/electron-browser/remoteFileService.ts
+27
-1
未找到文件。
src/vs/platform/files/common/files.ts
浏览文件 @
ded36ac6
...
@@ -576,6 +576,11 @@ export interface IUpdateContentOptions {
...
@@ -576,6 +576,11 @@ export interface IUpdateContentOptions {
* The etag of the file. This can be used to prevent dirty writes.
* The etag of the file. This can be used to prevent dirty writes.
*/
*/
etag
?:
string
;
etag
?:
string
;
/**
* Run mkdirp before saving.
*/
mkdirp
?:
boolean
;
}
}
export
interface
IResolveFileOptions
{
export
interface
IResolveFileOptions
{
...
...
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
浏览文件 @
ded36ac6
...
@@ -305,10 +305,15 @@ export class RemoteFileService extends FileService {
...
@@ -305,10 +305,15 @@ export class RemoteFileService extends FileService {
}
}
}
}
updateContent
(
resource
:
URI
,
value
:
string
|
ITextSnapshot
,
options
?:
IUpdateContentOptions
):
TPromise
<
IFileStat
>
{
async
updateContent
(
resource
:
URI
,
value
:
string
|
ITextSnapshot
,
options
?:
IUpdateContentOptions
):
TPromise
<
IFileStat
>
{
if
(
resource
.
scheme
===
Schemas
.
file
)
{
if
(
resource
.
scheme
===
Schemas
.
file
)
{
return
super
.
updateContent
(
resource
,
value
,
options
);
return
super
.
updateContent
(
resource
,
value
,
options
);
}
else
{
}
else
{
if
(
options
&&
options
.
mkdirp
)
{
// use the lack of options and or the lack of an etag as a hint that
// the parent directories might not exist.
await
this
.
_mkdirp
(
resource
.
with
({
path
:
posix
.
dirname
(
resource
.
path
)
}));
}
return
this
.
_withProvider
(
resource
).
then
(
provider
=>
{
return
this
.
_withProvider
(
resource
).
then
(
provider
=>
{
const
snapshot
=
typeof
value
===
'
string
'
?
new
StringSnapshot
(
value
)
:
value
;
const
snapshot
=
typeof
value
===
'
string
'
?
new
StringSnapshot
(
value
)
:
value
;
return
this
.
_writeFile
(
provider
,
resource
,
snapshot
,
options
||
{},
FileOpenFlags
.
Write
);
return
this
.
_writeFile
(
provider
,
resource
,
snapshot
,
options
||
{},
FileOpenFlags
.
Write
);
...
@@ -346,6 +351,27 @@ export class RemoteFileService extends FileService {
...
@@ -346,6 +351,27 @@ export class RemoteFileService extends FileService {
});
});
}
}
private
async
_mkdirp
(
directory
:
URI
):
Promise
<
void
>
{
let
basenames
:
string
[]
=
[];
while
(
directory
.
path
!==
'
/
'
)
{
try
{
let
stat
=
await
this
.
resolveFile
(
directory
);
if
(
!
stat
.
isDirectory
)
{
throw
new
Error
(
`
${
directory
.
toString
()}
is not a directory`
);
}
}
catch
(
e
)
{
// ENOENT
basenames
.
push
(
posix
.
basename
(
directory
.
path
));
directory
=
directory
.
with
({
path
:
posix
.
dirname
(
directory
.
path
)
});
}
break
;
}
for
(
let
i
=
basenames
.
length
-
1
;
i
>=
0
;
i
--
)
{
directory
=
directory
.
with
({
path
:
posix
.
join
(
directory
.
path
,
basenames
[
i
])
});
await
this
.
createFolder
(
directory
);
}
}
// --- delete
// --- delete
del
(
resource
:
URI
,
useTrash
?:
boolean
):
TPromise
<
void
>
{
del
(
resource
:
URI
,
useTrash
?:
boolean
):
TPromise
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录