]> Cypherpunks.ru repositories - goredo.git/blob - path.go
Remove duplicate check
[goredo.git] / path.go
1 package main
2
3 import (
4         "path"
5         "path/filepath"
6 )
7
8 func mustAbs(pth string) string {
9         pth, err := filepath.Abs(pth)
10         if err != nil {
11                 panic(err)
12         }
13         return pth
14 }
15
16 func mustRel(basepath, targpath string) string {
17         pth, err := filepath.Rel(basepath, targpath)
18         if err != nil {
19                 panic(err)
20         }
21         return pth
22 }
23
24 func cwdMustRel(paths ...string) string {
25         return mustRel(Cwd, path.Join(paths...))
26 }
27
28 func cwdAndTgt(tgt string) (string, string) {
29         cwd, tgt := path.Split(tgt)
30         return mustAbs(cwd), tgt
31 }