func download(src, dst string) error { if !utils.FileExists(dst) { if err := utils.CopyFileRemote(src, dst); nil != err { fmt.Printf("WARNING: %s.\n", err) return err } fmt.Printf("Downloading %s...OK\n", src) } return nil }
func main() { config.Parse() b := blender.New() b.Storage = storage.New(&storage.Config{ BaseDir: config.DirComponents, RemoteDir: config.DirRemote, }) b.Blend(config.Component) for dst, src := range b.Files { if !utils.FileExists(dst) { utils.CopyFile(src, config.DirWww+"/"+dst) } } // _ = c // fmt.Println("HTML:\n" + *c.Html) // fmt.Println("CSS:\n" + *c.Css) // fmt.Println("JS:\n" + *c.Js) }
func (s *Storage) Exists(l *location.Location) bool { p := s.Path(l) return utils.FileExists(p) }