diff options
Diffstat (limited to 'init.go')
| -rw-r--r-- | init.go | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -8,6 +8,7 @@ import ( "path/filepath" "go.wit.com/lib/config" + "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -66,6 +67,26 @@ func initFromConfig(cfg *ForgeConfigs) *Forge { os.Exit(-1) } + // todo: play with these / determine good values based on user's machine + if f.Config.RillX == 0 { + f.Config.RillX = 10 + } + if f.Config.RillY == 0 { + f.Config.RillY = 20 + } + + if !shell.Exists(f.Config.ReposPB) { + if f.Config.Mode == ForgeMode_NEWUSER { + // new user. drop back to main() for an introduction + return f + } + // create an initial repos.pb file + // panic() here? // warning? // (probably not. it's just the repos.pb cache file + f.Repos = gitpb.NewRepos() + f.Repos.Filename = f.Config.ReposPB + f.Repos.Save() + } + f.Repos = gitpb.NewRepos() f.Repos.ConfigLoad(f.Config.ReposPB) @@ -83,14 +104,6 @@ func initFromConfig(cfg *ForgeConfigs) *Forge { } } } - - // todo: play with these / determine good values based on user's machine - if f.Config.RillX == 0 { - f.Config.RillX = 10 - } - if f.Config.RillY == 0 { - f.Config.RillY = 20 - } return f } |
