func copyToRepos() (err error) { var ( dirName, dirPath, srcDirPath string fileInfos []os.FileInfo ) for _, repoBaseDirPath := range []string{"D:\\github", "C:\\gitrepos"} { if fileInfos, _ = ioutil.ReadDir(repoBaseDirPath); len(fileInfos) > 0 { for _, fi := range fileInfos { if dirName = fi.Name(); fi.IsDir() { for _, githubName := range subDirs { if srcDirPath = ugo.GopathSrcGithub(githubName, dirName); ufs.DirExists(srcDirPath) { break } } if dirPath = filepath.Join(repoBaseDirPath, dirName); ufs.DirExists(srcDirPath) { wg.Add(1) go func(dirPath, srcDirPath string) { defer wg.Done() var err error if err = ufs.ClearDirectory(dirPath, ".git"); err == nil { err = ufs.CopyAll(srcDirPath, dirPath, &dirTmpSkipper) } if err != nil { log.Printf("Error @ %s:\t%+v", dirPath, err) } }(dirPath, srcDirPath) } } } } } return }
// Initializes go:ngine; this first attempts to initialize OpenGL and then open a window to your supplied specifications with a GL 3.3-or-higher profile. func Init(fullscreen bool, ctx ngctx.CtxProvider) (err error) { var ( glVerIndex = len(ugl.KnownVersions) - 1 badVer, tmpDirPath string glVer float64 ) UserIO.ctx = ctx if err = ufs.EnsureDirExists(Core.fileIO.resolveLocalFilePath(Options.AppDir.Temp.BaseName)); err != nil { return } defer runtime.GC() if len(Options.AppDir.Temp.BaseName) > 0 { for _, diagTmpDirName := range []string{Options.AppDir.Temp.ShaderSources, Options.AppDir.Temp.CachedTextures} { tmpDirPath = Core.fileIO.resolveLocalFilePath(filepath.Join(Options.AppDir.Temp.BaseName, diagTmpDirName)) if err = ufs.EnsureDirExists(tmpDirPath); err != nil { return } } for _, diagTmpDirName := range []string{Options.AppDir.Temp.ShaderSources} { tmpDirPath = Core.fileIO.resolveLocalFilePath(filepath.Join(Options.AppDir.Temp.BaseName, diagTmpDirName)) if err = ufs.ClearDirectory(tmpDirPath); err != nil { return } } } if Options.Initialization.GlContext.CoreProfile.ForceFirst { for i, v := range ugl.KnownVersions { if v == Options.Initialization.GlContext.CoreProfile.VersionHint { glVerIndex = i break } } } tryInit: glVer, UserIO.Window.fullscreen = ugl.KnownVersions[glVerIndex], fullscreen if err = UserIO.init(glVer); err == nil { if err, badVer = ogl.init(); err == nil && len(badVer) == 0 { Stats.reset() Loop.init() if err = Core.init(); err != nil { return } Diag.LogIfGlErr("INIT") } else if len(badVer) > 0 && !Options.Initialization.GlContext.CoreProfile.ForceFirst { Options.Initialization.GlContext.CoreProfile.ForceFirst = true UserIO.isCtxInit, UserIO.Window.isCreated = false, false goto tryInit } } else if Options.Initialization.GlContext.CoreProfile.ForceFirst && (glVerIndex > 0) { glVerIndex-- UserIO.isCtxInit, UserIO.Window.isCreated = false, false goto tryInit } else { badVer = ogl.lastBadVer } if len(badVer) > 0 { err = errf(ogl.versionErrorMessage(glMinVerStr, badVer)) } return }
func copyToDropbox() (err error) { const dbp = "Dropbox/_gd" for _, dropDirPath := range []string{filepath.Join("D:", dbp), filepath.Join(ugo.UserHomeDirPath(), dbp)} { if ufs.DirExists(dropDirPath) { if err = ufs.ClearDirectory(dropDirPath); err == nil { for _, githubName := range subDirs { wg.Add(1) go func(dropDirPath, githubName string) { defer wg.Done() dst := filepath.Join(dropDirPath, githubName) if err := ufs.CopyAll(ugo.GopathSrcGithub(githubName), dst, &dirTmpSkipper); err != nil { log.Printf("Error @ %s:\t%+v", dst, err) } }(dropDirPath, githubName) } } break } } return }