Ejemplo n.º 1
0
// Initializes the last time every file was modified
func initFilesModTimes() map[string]time.Time {
	fileModTimes := make(map[string]time.Time)

	for _, f := range watchFiles {
		fInfo, err := os.Stat(f)
		if err != nil {
			output.FatalError(err)
		}
		fileModTimes[f] = fInfo.ModTime()
	}

	return fileModTimes
}
Ejemplo n.º 2
0
// Determines if any files were modified
// updates their lastModified time
func filesModified(fileModTimes map[string]time.Time) bool {
	returnVal := false
	for f := range fileModTimes {
		fInfo, err := os.Stat(f)
		if err != nil {
			output.FatalError(err)
		}
		if fileModTimes[f] != fInfo.ModTime() {
			fileModTimes[f] = fInfo.ModTime()
			returnVal = true
		}
	}
	return returnVal
}