basic functions working

This commit is contained in:
ston1th 2019-05-02 14:17:24 +02:00
commit ffeeae5702
22 changed files with 420 additions and 129 deletions

View file

@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"git.giftfish.de/ston1th/docstore/pkg/core"
"git.giftfish.de/ston1th/docstore/pkg/fs"
"git.giftfish.de/ston1th/docstore/pkg/log"
"git.giftfish.de/ston1th/godrop/v2"
"os"
@ -72,7 +73,7 @@ func New(base string, langs []string, timeout time.Duration) (s *Scanner, err er
}
func (s *Scanner) Scan(file string) (filename, text string, err error) {
file = filepath.Clean(file)
file = fs.Clean(file)
scanfile := filepath.Join(s.base, file)
var pdffile string
pdf := isPDF(scanfile)
@ -91,7 +92,7 @@ func (s *Scanner) Scan(file string) (filename, text string, err error) {
return
}
pdffile = filepath.Join(s.base, filename)
f, err = os.OpenFile(pdffile, os.O_RDWR|os.O_CREATE, 0640)
f, err = os.OpenFile(pdffile, os.O_RDWR|os.O_CREATE, fs.FileMode)
if err != nil {
f.Close()
return