File now produces an error'd icon for an erroneous file
This commit is contained in:
parent
8447b06641
commit
fff5ad4d96
@ -128,8 +128,7 @@ func (element *Directory) Update () error {
|
|||||||
element.children = make([]fileLayoutEntry, len(entries))
|
element.children = make([]fileLayoutEntry, len(entries))
|
||||||
for index, entry := range entries {
|
for index, entry := range entries {
|
||||||
filePath := filepath.Join(location, entry.Name())
|
filePath := filepath.Join(location, entry.Name())
|
||||||
file, err := NewFile(filePath, filesystem)
|
file, _ := NewFile(filePath, filesystem)
|
||||||
if err != nil { continue }
|
|
||||||
file.SetParent(element)
|
file.SetParent(element)
|
||||||
file.OnChoose (func () {
|
file.OnChoose (func () {
|
||||||
if element.onChoose != nil {
|
if element.onChoose != nil {
|
||||||
|
@ -69,14 +69,14 @@ func (element *File) SetLocation (
|
|||||||
|
|
||||||
// Update refreshes the element to match the file it represents.
|
// Update refreshes the element to match the file it represents.
|
||||||
func (element *File) Update () error {
|
func (element *File) Update () error {
|
||||||
element.iconID = theme.IconError
|
|
||||||
info, err := element.filesystem.Stat(element.location)
|
info, err := element.filesystem.Stat(element.location)
|
||||||
if err != nil { return err }
|
|
||||||
|
|
||||||
// TODO: choose icon based on file mime type
|
if err != nil {
|
||||||
if info.IsDir() {
|
element.iconID = theme.IconError
|
||||||
|
} else if info.IsDir() {
|
||||||
element.iconID = theme.IconDirectory
|
element.iconID = theme.IconDirectory
|
||||||
} else {
|
} else {
|
||||||
|
// TODO: choose icon based on file mime type
|
||||||
element.iconID = theme.IconFile
|
element.iconID = theme.IconFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user