-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Lines 250 to 252 in ae8ad1d
// extract the relative path of this file | |
_prefix := len(i._base) + 1 | |
_rel := string(path[_prefix:]) |
When the Match logic tries to resolve a relative path from 2 paths (eg. basepath, fullpath
), it simply tries to obtain the path after the length of the basepath in fullpath, i.e.
_prefix := len(i._base) + 1
_rel := string(path[_prefix:])
However, this would fail when the your basepath was /
. Also, there is already a function which finds out the relative path, i.e. path.filepath.Rel
, why not simply use that?
_rel, err := filepath.Rel(i._base, path)
Note: The /
being the repository path is a case when I am trying to find out all the files in the file-system which satisfy a certain gitignore.
Metadata
Metadata
Assignees
Labels
No labels