diff --git a/environment/api.go b/environment/api.go index 213d9ed4..54addb7e 100644 --- a/environment/api.go +++ b/environment/api.go @@ -13,7 +13,7 @@ func LoadRoot() (env_core.Root, error) { } else if assert, err := env_v0_3.Assert(); assert && err == nil { return env_v0_3.Load() } else { - return nil, err + return env_v0_4.Default() } } diff --git a/environment/env_v0_4/root.go b/environment/env_v0_4/root.go index 2a534339..28804bac 100644 --- a/environment/env_v0_4/root.go +++ b/environment/env_v0_4/root.go @@ -18,6 +18,19 @@ type Root struct { env *env_core.Environment } +func Default() (*Root, error) { + r := &Root{} + root, err := rootDir() + if err != nil { + return nil, err + } + r.meta = &env_core.Metadata{ + V: V, + RootPath: root, + } + return r, nil +} + func Assert() (bool, error) { exists, err := rootExists() if err != nil { @@ -55,14 +68,11 @@ func Load() (*Root, error) { } } else { - root, err := rootDir() + root, err := Default() if err != nil { return nil, err } - r.meta = &env_core.Metadata{ - V: V, - RootPath: root, - } + r = root } return r, nil }