mirror of
				https://github.com/owncast/owncast.git
				synced 2025-10-31 18:18:06 +08:00 
			
		
		
		
	Better handling of os.Stat() errors (#1173)
This commit is contained in:
		| @ -22,13 +22,14 @@ import ( | ||||
|  | ||||
| // DoesFileExists checks if the file exists. | ||||
| func DoesFileExists(name string) bool { | ||||
| 	if _, err := os.Stat(name); err != nil { | ||||
| 		if os.IsNotExist(err) { | ||||
| 			return false | ||||
| 		} | ||||
| 	if _, err := os.Stat(name); err == nil { | ||||
| 		return true | ||||
| 	} else if os.IsNotExist(err) { | ||||
| 		return false | ||||
| 	} else { | ||||
| 		log.Errorln(err) | ||||
| 		return false | ||||
| 	} | ||||
|  | ||||
| 	return true | ||||
| } | ||||
|  | ||||
| // GetRelativePathFromAbsolutePath gets the relative path from the provided absolute path. | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Meisam
					Meisam