Added comment to --include-wd code
parent
65c51df1ed
commit
23a4e07c1d
3
main.go
3
main.go
|
@ -136,6 +136,9 @@ func SetVenture(args []string) error {
|
||||||
|
|
||||||
// If they're in their home directory, swap /home/user out for ~user
|
// If they're in their home directory, swap /home/user out for ~user
|
||||||
homelessPath, err := filepath.Rel(curUser.HomeDir, wd)
|
homelessPath, err := filepath.Rel(curUser.HomeDir, wd)
|
||||||
|
|
||||||
|
// Gotta be careful because Rel doesn't care if wd is a subdirectory of HomeDir,
|
||||||
|
// it'll slather as much "../../.." as it needs to make it relative.
|
||||||
if err == nil && !strings.HasPrefix(homelessPath, "..") {
|
if err == nil && !strings.HasPrefix(homelessPath, "..") {
|
||||||
wd = filepath.Join("~"+curUser.Username, homelessPath)
|
wd = filepath.Join("~"+curUser.Username, homelessPath)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue