Files
crawlab/core/fs/default.go
2024-11-18 16:48:09 +08:00

26 lines
515 B
Go

package fs
import (
"github.com/apex/log"
"github.com/crawlab-team/crawlab/core/utils"
"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 := utils.GetWorkspace()
if workspacePath == "" {
viper.Set("workspace", DefaultWorkspacePath)
}
}
var DefaultWorkspacePath string