added privacy policy page and about section, improved dir check, fixed crash when idexer is disabled
This commit is contained in:
parent
61266c461a
commit
5ae97da6d0
18 changed files with 698 additions and 107 deletions
18
init.go
18
init.go
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
var config Config
|
||||
|
@ -77,9 +78,18 @@ func main() {
|
|||
|
||||
// Check if the cache directory exists when caching is enabled
|
||||
if config.DriveCacheEnabled {
|
||||
if _, err := os.Stat(config.DriveCache.Path); os.IsNotExist(err) {
|
||||
printErr("Error: Drive cache is enabled, but cache directory '%s' does not exist.\n", config.DriveCache.Path)
|
||||
os.Exit(1) // Exit with a non-zero status to indicate an error
|
||||
cacheDir := config.DriveCache.Path
|
||||
imagesDir := filepath.Join(cacheDir, "images")
|
||||
|
||||
// Check if the directory already exists
|
||||
if _, err := os.Stat(imagesDir); os.IsNotExist(err) {
|
||||
// Try to create the directory since it doesn't exist
|
||||
if err := os.MkdirAll(imagesDir, os.ModePerm); err != nil {
|
||||
printErr("Error: Failed to create cache or images directory '%s': %v", imagesDir, err)
|
||||
os.Exit(1) // Exit with a non-zero status to indicate an error
|
||||
}
|
||||
// Print a warning if the directory had to be created
|
||||
printWarn("Warning: Created missing directory '%s'.", imagesDir)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +119,7 @@ func main() {
|
|||
|
||||
err := InitIndex()
|
||||
if err != nil {
|
||||
printErr("Failed to initialize index:", err)
|
||||
printErr("Failed to initialize index: %v", err)
|
||||
}
|
||||
|
||||
webCrawlerInit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue