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))
 | 
			
		||||
	for index, entry := range entries {
 | 
			
		||||
		filePath := filepath.Join(location, entry.Name())
 | 
			
		||||
		file, err := NewFile(filePath, filesystem)
 | 
			
		||||
		if err != nil { continue }
 | 
			
		||||
		file, _ := NewFile(filePath, filesystem)
 | 
			
		||||
		file.SetParent(element)
 | 
			
		||||
		file.OnChoose (func () {
 | 
			
		||||
			if element.onChoose != nil {
 | 
			
		||||
 | 
			
		||||
@ -69,14 +69,14 @@ func (element *File) SetLocation (
 | 
			
		||||
 | 
			
		||||
// Update refreshes the element to match the file it represents.
 | 
			
		||||
func (element *File) Update () error {
 | 
			
		||||
	element.iconID = theme.IconError
 | 
			
		||||
	info, err := element.filesystem.Stat(element.location)
 | 
			
		||||
	if err != nil { return err }
 | 
			
		||||
 | 
			
		||||
	// TODO: choose icon based on file mime type
 | 
			
		||||
	if info.IsDir() {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		element.iconID = theme.IconError
 | 
			
		||||
	} else if info.IsDir() {
 | 
			
		||||
		element.iconID = theme.IconDirectory
 | 
			
		||||
	} else {
 | 
			
		||||
		// TODO: choose icon based on file mime type
 | 
			
		||||
		element.iconID = theme.IconFile
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user