WIP
This commit is contained in:
parent
6db838907c
commit
946bf27f58
15
epwing.go
15
epwing.go
@ -24,6 +24,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -66,8 +67,18 @@ func epwingExportDb(inputPath, outputDir, title string, pretty bool) error {
|
|||||||
|
|
||||||
var data []byte
|
var data []byte
|
||||||
if stat.IsDir() {
|
if stat.IsDir() {
|
||||||
baseDir := filepath.Dir(os.Args[0])
|
toolPath := filepath.Join(
|
||||||
toolPath := filepath.Join(baseDir, "bin", runtime.GOOS, "zero-epwing")
|
filepath.Dir(os.Args[0]),
|
||||||
|
"bin",
|
||||||
|
runtime.GOOS,
|
||||||
|
"zero-epwing",
|
||||||
|
)
|
||||||
|
|
||||||
|
_, err := os.Stat(toolPath)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to find extractor in '%s'", toolPath)
|
||||||
|
}
|
||||||
|
|
||||||
data, err = exec.Command(toolPath, inputPath).Output()
|
data, err = exec.Command(toolPath, inputPath).Output()
|
||||||
} else {
|
} else {
|
||||||
data, err = ioutil.ReadFile(inputPath)
|
data, err = ioutil.ReadFile(inputPath)
|
||||||
|
Loading…
Reference in New Issue
Block a user