Add new data.go file, WIP

This commit is contained in:
Felix Geisendörfer 2013-03-18 09:36:13 +01:00
parent fb8c065fef
commit db98c72b3e
1 changed files with 33 additions and 0 deletions

33
src/cmd/tusd/data.go Normal file
View File

@ -0,0 +1,33 @@
package main
// This is very simple for now and will be enhanced as needed.
import (
"os"
"path"
)
var dataDir string
func init() {
wd, err := os.Getwd()
if err != nil {
panic(err)
}
dataDir = path.Join(wd, "tus_data")
if err := os.MkdirAll(dataDir, 0777); err != nil {
panic(err)
}
}
func dataPath(fileId string) string {
return path.Join(dataDir, fileId)
}
func logPath(fileId string) string {
return dataPath(fileId)+".log"
}
func initDataFile(id string, size int) {
}