MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / EnsureRoot

Function EnsureRoot

config/toml.go:33–50  ·  view source on GitHub ↗

****** these are for production settings ***********/ EnsureRoot creates the root, config, and data directories if they don't exist, and panics if it fails.

(rootDir string)

Source from the content-addressed store, hash-verified

31// EnsureRoot creates the root, config, and data directories if they don't exist,
32// and panics if it fails.
33func EnsureRoot(rootDir string) {
34 if err := tmos.EnsureDir(rootDir, DefaultDirPerm); err != nil {
35 panic(err.Error())
36 }
37 if err := tmos.EnsureDir(filepath.Join(rootDir, defaultConfigDir), DefaultDirPerm); err != nil {
38 panic(err.Error())
39 }
40 if err := tmos.EnsureDir(filepath.Join(rootDir, defaultDataDir), DefaultDirPerm); err != nil {
41 panic(err.Error())
42 }
43
44 configFilePath := filepath.Join(rootDir, defaultConfigFilePath)
45
46 // Write default config file if missing.
47 if !tmos.FileExists(configFilePath) {
48 writeDefaultConfigFile(configFilePath)
49 }
50}
51
52// XXX: this func should probably be called by cmd/tendermint/commands/init.go
53// alongside the writing of the genesis.json and priv_validator.json

Callers 1

TestEnsureRootFunction · 0.85

Calls 2

writeDefaultConfigFileFunction · 0.85
ErrorMethod · 0.65

Tested by 1

TestEnsureRootFunction · 0.68