frontend: move file (on the same partition) instead of open, write, close the final file
This commit is contained in:
parent
1da33c2f3a
commit
a11b285cf4
2 changed files with 21 additions and 31 deletions
|
@ -17,6 +17,7 @@ const startedFile = "started"
|
|||
|
||||
var TeamsDir string
|
||||
var SubmissionDir string
|
||||
var TmpSubmissionDir string
|
||||
|
||||
var touchTimer *time.Timer = nil
|
||||
|
||||
|
@ -70,10 +71,11 @@ func main() {
|
|||
log.SetPrefix("[frontend] ")
|
||||
|
||||
SubmissionDir = path.Clean(SubmissionDir)
|
||||
TmpSubmissionDir = path.Join(SubmissionDir, ".tmp")
|
||||
|
||||
log.Println("Creating submission directory...")
|
||||
if _, err := os.Stat(SubmissionDir); os.IsNotExist(err) {
|
||||
if err := os.MkdirAll(SubmissionDir, 0777); err != nil {
|
||||
if _, err := os.Stat(TmpSubmissionDir); os.IsNotExist(err) {
|
||||
if err := os.MkdirAll(TmpSubmissionDir, 0777); err != nil {
|
||||
log.Fatal("Unable to create submission directory: ", err)
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue