mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 21:59:12 +00:00
Make sure that photo directory for user exists
If user directory doesn't exist anymore report an error notification.
This commit is contained in:
@@ -99,6 +99,17 @@ func ScanUser(database *sql.DB, userId int) error {
|
||||
|
||||
func scan(database *sql.DB, user *models.User) {
|
||||
|
||||
// Check if user directory exists on the file system
|
||||
if _, err := os.Stat(user.RootPath); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
ScannerError("Photo directory for user '%s' does not exist '%s'\n", user.Username, user.RootPath)
|
||||
} else {
|
||||
ScannerError("Could not read photo directory for user '%s': %s\n", user.Username, user.RootPath)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
notifyKey := utils.GenerateToken()
|
||||
processKey := utils.GenerateToken()
|
||||
notifyThrottle := utils.NewThrottle(500 * time.Millisecond)
|
||||
|
||||
Reference in New Issue
Block a user