copyFileToDir copies given file path into node that is a directory. This does NOT check for overwriting -- that must be done at higher level!
(filename string, perm os.FileMode)
| 262 | // copyFileToDir copies given file path into node that is a directory. |
| 263 | // This does NOT check for overwriting -- that must be done at higher level! |
| 264 | func (fn *Node) copyFileToDir(filename string, perm os.FileMode) { |
| 265 | if fn.isExternal() { |
| 266 | return |
| 267 | } |
| 268 | ppath := string(fn.Filepath) |
| 269 | sfn := filepath.Base(filename) |
| 270 | tpath := filepath.Join(ppath, sfn) |
| 271 | fileinfo.CopyFile(tpath, filename, perm) |
| 272 | fn.FileRoot.UpdatePath(ppath) |
| 273 | ofn, ok := fn.FileRoot.FindFile(filename) |
| 274 | if ok && ofn.Info.VCS >= vcs.Stored { |
| 275 | nfn, ok := fn.FileRoot.FindFile(tpath) |
| 276 | if ok && nfn.This != fn.FileRoot.This { |
| 277 | if string(nfn.Filepath) != tpath { |
| 278 | fmt.Printf("error: nfn.FPath != tpath; %q != %q, see bug #453\n", nfn.Filepath, tpath) |
| 279 | } else { |
| 280 | nfn.AddToVCS() // todo: this sometimes is not just tpath! See bug #453 |
| 281 | } |
| 282 | nfn.Update() |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | // Shows file information about selected file(s) |
| 288 | func (fn *Node) showFileInfo() { //types:add |
no test coverage detected