mirror of
https://github.com/safing/portbase
synced 2025-09-01 01:59:48 +00:00
27 lines
451 B
Go
27 lines
451 B
Go
package dataroot
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
|
|
"github.com/safing/portbase/utils"
|
|
)
|
|
|
|
var (
|
|
root *utils.DirStructure
|
|
)
|
|
|
|
// Initialize initializes the data root directory
|
|
func Initialize(rootDir string, perm os.FileMode) error {
|
|
if root != nil {
|
|
return errors.New("already initialized")
|
|
}
|
|
|
|
root = utils.NewDirStructure(rootDir, perm)
|
|
return root.Ensure()
|
|
}
|
|
|
|
// Root returns the data root directory.
|
|
func Root() *utils.DirStructure {
|
|
return root
|
|
}
|