pasteCopyFiles copies files in given data into given target directory
(tdir *Node, md mimedata.Mimes, externalDrop bool)
| 118 | |
| 119 | // pasteCopyFiles copies files in given data into given target directory |
| 120 | func (fn *Node) pasteCopyFiles(tdir *Node, md mimedata.Mimes, externalDrop bool) { |
| 121 | froot := fn.FileRoot |
| 122 | nf := len(md) |
| 123 | if !externalDrop { |
| 124 | nf /= 3 |
| 125 | } |
| 126 | for i := 0; i < nf; i++ { |
| 127 | var d *mimedata.Data |
| 128 | mode := os.FileMode(0664) |
| 129 | if !externalDrop { |
| 130 | d = md[i*3+1] |
| 131 | npath := string(md[i*3].Data) |
| 132 | sfni := froot.FindPath(npath) |
| 133 | if sfni == nil { |
| 134 | slog.Error("filetree.Node: could not find path", "path", npath) |
| 135 | continue |
| 136 | } |
| 137 | sfn := AsNode(sfni) |
| 138 | mode = sfn.Info.Mode |
| 139 | } else { |
| 140 | d = md[i] // just a list |
| 141 | } |
| 142 | if d.Type != fileinfo.TextPlain { |
| 143 | continue |
| 144 | } |
| 145 | path := string(d.Data) |
| 146 | path = strings.TrimPrefix(path, "file://") |
| 147 | tdir.copyFileToDir(path, mode) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | // pasteCopyFilesCheck copies files into given directory node, |
| 152 | // first checking if any already exist -- if they exist, prompts. |
no test coverage detected