Skip to content

Commit

Permalink
Fix File Mod Time
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimau committed Jul 12, 2015
1 parent c362e6c commit eed5a74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 12 additions & 4 deletions fpWebMain.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,33 @@ func processCommand(line string) {
}
}

func copyFolderOver(folder string, destFolder string) {
func copyFolderOver(folder string, destFolder string, c chan (int)) {
err := CopyTree("./"+folder, publicHtmlRoot+destFolder, false)

if err != nil {
log.Fatalln("Failed to copy %s because %s", folder, err)
}

log.Println("Copied %s to web root", folder)
log.Printf("Copied %s to web root\n", folder)
c <- 1
}

func main() {
log.Println(buildDate)

os.RemoveAll(publicHtmlRoot)
go copyFolderOver("/static_folder", "/")
go copyFolderOver("/images", "/images")
c1 := make(chan int)
c2 := make(chan int)
go copyFolderOver("/static_folder", "/", c1)
go copyFolderOver("/images", "/images", c2)

genWebsite()

// wait on gen
log.Println("----------------------------------------------\n Waiting on file copies...")
<-c1
<-c2

wf := MakeWebFace(":1667", publicHtmlRoot)
lines := scanForInput()

Expand Down
4 changes: 3 additions & 1 deletion helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ func CopyTree(src string, dest string, verbose bool) error {
if err != nil {
return err
}
defer destFile.Close()

_, err = io.CopyN(destFile, srcFile, info.Size())
destFile.Close()
os.Chtimes(myDest, info.ModTime(), info.ModTime())

if err != nil {
return err
}
Expand Down

0 comments on commit eed5a74

Please sign in to comment.