Files
sys/fs.go
George Suntres 783e21ea9d Initial import
2026-03-29 11:37:56 -04:00

19 lines
407 B
Go

package sys
import (
"runtime"
"path/filepath"
)
func Rootify(path string) string {
return filepath.Join(GetProjectRoot(), path)
}
func GetProjectRoot() string {
_, b, _, _ := runtime.Caller(0)
// b is the absolute path to this specific .go file
// 1st Dir() gets the folder containing the file
// 2nd Dir() gets the parent of that folder
return filepath.Dir(filepath.Dir(b))
}