Added comment to --include-wd code

main
diff 2020-11-13 06:11:20 +00:00
parent 65c51df1ed
commit 23a4e07c1d
1 changed files with 3 additions and 0 deletions

View File

@ -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)
} }