精简后的项目:仅保留 api/ui 源码、文档、构建依赖
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package scanner_utils
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
func FileExists(testPath string) bool {
|
||||
_, err := os.Stat(testPath)
|
||||
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
} else if err != nil {
|
||||
// unexpected error logging
|
||||
log.Printf("Error: checking for file existence (%s): %s", testPath, err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package scanner_utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/photoview/photoview/api/graphql/models"
|
||||
"github.com/photoview/photoview/api/graphql/notification"
|
||||
"github.com/photoview/photoview/api/log"
|
||||
"github.com/photoview/photoview/api/utils"
|
||||
)
|
||||
|
||||
func ScannerError(ctx context.Context, format string, args ...any) {
|
||||
message := fmt.Sprintf(format, args...)
|
||||
|
||||
log.Error(ctx, message)
|
||||
notification.BroadcastNotification(&models.Notification{
|
||||
Key: utils.GenerateToken(),
|
||||
Type: models.NotificationTypeMessage,
|
||||
Header: "Scanner error",
|
||||
Content: message,
|
||||
Negative: true,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user