Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
a2f15faa
提交
a2f15faa
authored
12月 18, 2018
作者:
Łukasz Magiera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
files2.0: address review
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
上级
1fe28bc6
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
11 行增加
和
5 行删除
+11
-5
init.go
cmd/ipfs/init.go
+8
-4
cat.go
core/commands/cat.go
+1
-1
file.go
core/commands/cmdenv/file.go
+1
-0
errors.go
core/coreapi/interface/errors.go
+1
-0
没有找到文件。
cmd/ipfs/init.go
浏览文件 @
a2f15faa
...
...
@@ -87,15 +87,19 @@ environment variable:
f
:=
req
.
Files
if
f
!=
nil
{
it
:=
req
.
Files
.
Entries
()
if
!
it
.
Next
()
&&
it
.
Err
()
!=
nil
{
return
it
.
Err
()
if
!
it
.
Next
()
{
if
it
.
Err
()
!=
nil
{
return
it
.
Err
()
}
return
fmt
.
Errorf
(
"file argument was nil"
)
}
if
files
.
FileFromEntry
(
it
)
==
nil
{
file
:=
files
.
FileFromEntry
(
it
)
if
file
==
nil
{
return
fmt
.
Errorf
(
"expected a regular file"
)
}
conf
=
&
config
.
Config
{}
if
err
:=
json
.
NewDecoder
(
file
s
.
FileFromEntry
(
it
)
)
.
Decode
(
conf
);
err
!=
nil
{
if
err
:=
json
.
NewDecoder
(
file
)
.
Decode
(
conf
);
err
!=
nil
{
return
err
}
}
...
...
core/commands/cat.go
浏览文件 @
a2f15faa
...
...
@@ -130,7 +130,7 @@ func cat(ctx context.Context, api iface.CoreAPI, paths []string, offset int64, m
file
,
ok
:=
f
.
(
files
.
File
)
if
!
ok
{
return
nil
,
0
,
iface
.
Err
IsDir
return
nil
,
0
,
iface
.
Err
NotFile
}
fsize
,
err
:=
file
.
Size
()
...
...
core/commands/cmdenv/file.go
浏览文件 @
a2f15faa
...
...
@@ -6,6 +6,7 @@ import (
files
"gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files"
)
// GetFileArg returns the next file from the directory or an error
func
GetFileArg
(
it
files
.
DirIterator
)
(
files
.
File
,
error
)
{
if
!
it
.
Next
()
{
err
:=
it
.
Err
()
...
...
core/coreapi/interface/errors.go
浏览文件 @
a2f15faa
...
...
@@ -4,5 +4,6 @@ import "errors"
var
(
ErrIsDir
=
errors
.
New
(
"this dag node is a directory"
)
ErrNotFile
=
errors
.
New
(
"this dag node is not a regular file"
)
ErrOffline
=
errors
.
New
(
"this action must be run in online mode, try running 'ipfs daemon' first"
)
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论