Move settings and started file into SETTINGS directory
This commit is contained in:
parent
0d7d49e033
commit
f1d6b92267
7 changed files with 22 additions and 10 deletions
|
@ -12,10 +12,12 @@ import (
|
|||
|
||||
const startedFile = "started"
|
||||
|
||||
var SettingsDir string
|
||||
|
||||
var touchTimer *time.Timer = nil
|
||||
|
||||
func touchStartedFile() {
|
||||
if fd, err := os.Create(path.Join(SubmissionDir, startedFile)); err == nil {
|
||||
if fd, err := os.Create(path.Join(SettingsDir, startedFile)); err == nil {
|
||||
log.Println("Started! Go, Go, Go!!")
|
||||
fd.Close()
|
||||
} else {
|
||||
|
@ -32,8 +34,8 @@ func reloadSettings(config settings.FICSettings) {
|
|||
if startSub > 0 {
|
||||
log.Println("Challenge will starts at", config.Start, "in", startSub)
|
||||
|
||||
if _, err := os.Stat(path.Join(SubmissionDir, startedFile)); !os.IsNotExist(err) {
|
||||
os.Remove(path.Join(SubmissionDir, startedFile))
|
||||
if _, err := os.Stat(path.Join(SettingsDir, startedFile)); !os.IsNotExist(err) {
|
||||
os.Remove(path.Join(SettingsDir, startedFile))
|
||||
}
|
||||
|
||||
touchTimer = time.AfterFunc(config.Start.Sub(time.Now().Add(time.Duration(1 * time.Second))), touchStartedFile)
|
||||
|
|
Reference in a new issue