INNER CODE UNIT · Go
label
g3n/g3nd · util/fileselect.go:237
label := sel.(*gui.ImageLabel)
text := label.Text()
// Checks if previous directory
if text == ".." {
dir, _ := filepath.Split(fs.pathLabel.Text())
fs.SetPath(filepath.Dir(dir))
return
}
// Checks if it is a directory
path := filepath.Join(fs.pathLabel.Text(), text)
s, err := os.Stat(path)
if err != nil {
panic(err)
}
if s.IsDir() {
fs.SetPath(path)