]> Sergey Matveev's repositories - glocate.git/blobdiff - main.go
Use database's directory for temporary files
[glocate.git] / main.go
diff --git a/main.go b/main.go
index affdffc8d95d0c7179d7cc9359c524cb8f963669053a888a9da1f6d8b3e237e5..c18be4409d252ffa15b06e852f3a9f8b23fcf6339038057ae82c20a429f934bd 100644 (file)
--- a/main.go
+++ b/main.go
@@ -5,10 +5,13 @@ import (
        "log"
        "os"
        "path"
+       "path/filepath"
        "strings"
        "syscall"
 )
 
+var TmpDir string
+
 type Ent struct {
        name  []string
        mtime int64
@@ -41,6 +44,13 @@ func main() {
        flag.Parse()
        log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile)
 
+       var err error
+       TmpDir, err = filepath.Abs(*dbPath)
+       if err != nil {
+               panic(err)
+       }
+       TmpDir = path.Dir(TmpDir)
+
        if *doIndex {
                tmp := index()
                tmp.Close()