aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-12-22 00:08:40 +0700
committerShulhan <ms@kilabit.info>2023-12-22 00:08:40 +0700
commit1ba33791ffb7be31358ed776448ee86b4438dad3 (patch)
tree352d76a515974584f5198df17d822e574d77efcb
parente4a56396edad5760d3309fe4630fe0c770f5d22b (diff)
downloadawwan-1ba33791ffb7be31358ed776448ee86b4438dad3.tar.xz
all: update comment on relativePath function
-rw-r--r--awwan.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/awwan.go b/awwan.go
index c987fc2..bb8ded4 100644
--- a/awwan.go
+++ b/awwan.go
@@ -506,12 +506,12 @@ func lookupBaseDir(baseDir, currDir string) (dir string, err error) {
return dir, nil
}
-// relativePath return the relative path based on baseDir.
-// It will return path without baseDir prefix on success, or unchanged path
-// if no baseDir.
-func relativePath(baseDir, path string) (relpath string) {
+// relativePath return the relative path based on dir.
+// It will return path without dir prefix on success or unchanged if dir is
+// not a prefix of path or has any error.
+func relativePath(dir, path string) (relpath string) {
var err error
- relpath, err = filepath.Rel(baseDir, path)
+ relpath, err = filepath.Rel(dir, path)
if err != nil {
relpath = path
}