1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-28 08:47:42 +08:00

implement symlinks in unixfs, first draft

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2015-08-12 12:17:52 -07:00
parent 8c652907de
commit d993bc04d6
10 changed files with 152 additions and 9 deletions

View File

@ -143,6 +143,7 @@ remains to be implemented.
return nil // done
}
log.Errorf("FILE: %#v", file)
if _, err := fileAdder.addFile(file); err != nil {
return err
}
@ -359,6 +360,23 @@ func (params *adder) addFile(file files.File) (*dag.Node, error) {
return params.addDir(file)
}
if s, ok := file.(*files.Symlink); ok {
log.Error("SYMLINK: ", s)
log.Error(s.Target)
log.Error(s.FileName())
dagnode := &dag.Node{
Data: ft.SymlinkData(s.Target),
}
_, err := params.node.DAG.Add(dagnode)
if err != nil {
return nil, err
}
err = params.addNode(dagnode, s.FileName())
return dagnode, err
}
// if the progress flag was specified, wrap the file so that we can send
// progress updates to the client (over the output channel)
var reader io.Reader = file