Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
6a9c5b44
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,发现更多精彩内容 >>
提交
6a9c5b44
编写于
6月 21, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
With Joh remote file service: throw when doing a mutating action
上级
e4544962
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
6 deletion
+14
-6
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
...ench/services/files/electron-browser/remoteFileService.ts
+14
-6
未找到文件。
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
浏览文件 @
6a9c5b44
...
...
@@ -443,12 +443,20 @@ export class RemoteFileService extends FileService {
}
}
private
static
_throwIfFileSystemIsReadonly
(
provider
:
IFileSystemProvider
):
IFileSystemProvider
{
if
(
provider
.
capabilities
&
FileSystemProviderCapabilities
.
Readonly
)
{
throw
new
FileOperationError
(
localize
(
'
err.readonly
'
,
"
Resource can not be modified.
"
),
FileOperationResult
.
FILE_PERMISSION_DENIED
);
}
return
provider
;
}
createFile
(
resource
:
URI
,
content
?:
string
,
options
?:
ICreateFileOptions
):
TPromise
<
IFileStat
>
{
if
(
resource
.
scheme
===
Schemas
.
file
)
{
return
super
.
createFile
(
resource
,
content
,
options
);
}
else
{
return
this
.
_withProvider
(
resource
).
then
(
provider
=>
{
return
this
.
_withProvider
(
resource
).
then
(
RemoteFileService
.
_throwIfFileSystemIsReadonly
).
then
(
provider
=>
{
return
RemoteFileService
.
_mkdirp
(
provider
,
resource
.
with
({
path
:
posix
.
dirname
(
resource
.
path
)
})).
then
(()
=>
{
const
encoding
=
this
.
encoding
.
getWriteEncoding
(
resource
);
return
this
.
_writeFile
(
provider
,
resource
,
new
StringSnapshot
(
content
),
encoding
,
{
create
:
true
,
overwrite
:
Boolean
(
options
&&
options
.
overwrite
)
});
...
...
@@ -469,7 +477,7 @@ export class RemoteFileService extends FileService {
if
(
resource
.
scheme
===
Schemas
.
file
)
{
return
super
.
updateContent
(
resource
,
value
,
options
);
}
else
{
return
this
.
_withProvider
(
resource
).
then
(
provider
=>
{
return
this
.
_withProvider
(
resource
).
then
(
RemoteFileService
.
_throwIfFileSystemIsReadonly
).
then
(
provider
=>
{
return
RemoteFileService
.
_mkdirp
(
provider
,
resource
.
with
({
path
:
posix
.
dirname
(
resource
.
path
)
})).
then
(()
=>
{
const
snapshot
=
typeof
value
===
'
string
'
?
new
StringSnapshot
(
value
)
:
value
;
return
this
.
_writeFile
(
provider
,
resource
,
snapshot
,
options
&&
options
.
encoding
,
{
create
:
true
,
overwrite
:
true
});
...
...
@@ -515,7 +523,7 @@ export class RemoteFileService extends FileService {
if
(
resource
.
scheme
===
Schemas
.
file
)
{
return
super
.
del
(
resource
,
useTrash
);
}
else
{
return
this
.
_withProvider
(
resource
).
then
(
provider
=>
{
return
this
.
_withProvider
(
resource
).
then
(
RemoteFileService
.
_throwIfFileSystemIsReadonly
).
then
(
provider
=>
{
return
provider
.
delete
(
resource
).
then
(()
=>
{
this
.
_onAfterOperation
.
fire
(
new
FileOperationEvent
(
resource
,
FileOperation
.
DELETE
));
});
...
...
@@ -527,7 +535,7 @@ export class RemoteFileService extends FileService {
if
(
resource
.
scheme
===
Schemas
.
file
)
{
return
super
.
createFolder
(
resource
);
}
else
{
return
this
.
_withProvider
(
resource
).
then
(
provider
=>
{
return
this
.
_withProvider
(
resource
).
then
(
RemoteFileService
.
_throwIfFileSystemIsReadonly
).
then
(
provider
=>
{
return
RemoteFileService
.
_mkdirp
(
provider
,
resource
.
with
({
path
:
posix
.
dirname
(
resource
.
path
)
})).
then
(()
=>
{
return
provider
.
mkdir
(
resource
).
then
(()
=>
{
return
this
.
resolveFile
(
resource
);
...
...
@@ -556,7 +564,7 @@ export class RemoteFileService extends FileService {
?
this
.
del
(
target
).
then
(
undefined
,
err
=>
{
/*ignore*/
})
:
TPromise
.
as
(
null
);
return
prepare
.
then
(()
=>
this
.
_withProvider
(
source
)).
then
(
provider
=>
{
return
prepare
.
then
(()
=>
this
.
_withProvider
(
source
)).
then
(
RemoteFileService
.
_throwIfFileSystemIsReadonly
).
then
(
provider
=>
{
return
provider
.
rename
(
source
,
target
,
{
overwrite
}).
then
(()
=>
{
return
this
.
resolveFile
(
target
);
}).
then
(
fileStat
=>
{
...
...
@@ -588,7 +596,7 @@ export class RemoteFileService extends FileService {
return
super
.
copyFile
(
source
,
target
,
overwrite
);
}
return
this
.
_withProvider
(
target
).
then
(
provider
=>
{
return
this
.
_withProvider
(
target
).
then
(
RemoteFileService
.
_throwIfFileSystemIsReadonly
).
then
(
provider
=>
{
if
(
source
.
scheme
===
target
.
scheme
&&
(
provider
.
capabilities
&
FileSystemProviderCapabilities
.
FileFolderCopy
))
{
// good: provider supports copy withing scheme
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录