Files
crawlab/core/fs/default.go
2024-06-14 15:42:50 +08:00

25 lines
477 B
Go

package fs
import (
"github.com/apex/log"
"github.com/mitchellh/go-homedir"
"github.com/spf13/viper"
"path/filepath"
)
func init() {
rootDir, err := homedir.Dir()
if err != nil {
log.Warnf("cannot find home directory: %v", err)
return
}
DefaultWorkspacePath = filepath.Join(rootDir, "crawlab_workspace")
workspacePath := viper.GetString("workspace")
if workspacePath == "" {
viper.Set("workspace", DefaultWorkspacePath)
}
}
var DefaultWorkspacePath string