maintain (path): absolute path

getting things ready to have config coming as a plugin to handle
various distributions
This commit is contained in:
Mickael Kerjean
2023-03-02 20:15:56 +11:00
parent 8059730720
commit 8ca7a0e3f9
18 changed files with 34 additions and 40 deletions

View File

@ -31,7 +31,7 @@ var (
func init() {
FileCache = NewAppCache()
cachePath := filepath.Join(GetCurrentDir(), TMP_PATH)
cachePath := GetAbsolutePath(TMP_PATH)
FileCache.OnEvict(func(key string, value interface{}) {
os.RemoveAll(filepath.Join(cachePath, key))
})
@ -235,7 +235,7 @@ func FileCat(ctx *App, res http.ResponseWriter, req *http.Request) {
}
}
} else {
tmpPath := filepath.Join(GetCurrentDir(), TMP_PATH, "file_"+QuickString(20)+".dat")
tmpPath := GetAbsolutePath(TMP_PATH, "file_"+QuickString(20)+".dat")
f, err := os.OpenFile(tmpPath, os.O_RDWR|os.O_CREATE, os.ModePerm)
if err != nil {
Log.Debug("cat::range0 '%s'", err.Error())