Created
January 17, 2018 16:40
-
-
Save mlbright/7d65a5bbd3b29a6a2886da8f49d0e986 to your computer and use it in GitHub Desktop.
Revisions
-
mlbright created this gist
Jan 17, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ package main import ( "fmt" "path/filepath" ) func main() { paths := []string{ "/home/arnie/amelia.jpg", "/mnt/photos/", "/mnt/photos", "mnt/photos", "rabbit.jpg", "/usr/local//go", ".", "/", } fmt.Println("On Unix:") for _, p := range paths { dir, file := filepath.Split(p) fmt.Printf("input: %q\n\tdir: %q\n\tfilepath.Dir: %q\n\tfile: %q\n", p, dir, filepath.Dir(p), file) } }