delete sqlite3

This commit is contained in:
Sadayuki Matsuno
2016-08-18 22:11:10 +09:00
parent a46c603c77
commit 595729cdf8
25 changed files with 241 additions and 465 deletions

View File

@@ -30,13 +30,13 @@ import (
"github.com/gosuri/uitable"
)
func ensureResultDir() (path string, err error) {
func ensureResultDir(scannedAt time.Time) (path string, err error) {
if resultDirPath != "" {
return resultDirPath, nil
}
const timeLayout = "20060102_1504"
timedir := time.Now().Format(timeLayout)
timedir := scannedAt.Format(timeLayout)
wd, _ := os.Getwd()
dir := filepath.Join(wd, "results", timedir)
if err := os.MkdirAll(dir, 0755); err != nil {
@@ -44,7 +44,7 @@ func ensureResultDir() (path string, err error) {
}
symlinkPath := filepath.Join(wd, "results", "current")
if _, err := os.Stat(symlinkPath); err == nil {
if _, err := os.Lstat(symlinkPath); err == nil {
if err := os.Remove(symlinkPath); err != nil {
return "", fmt.Errorf(
"Failed to remove symlink. path: %s, err: %s", symlinkPath, err)