mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-28 16:01:18 -05:00
18 lines
506 B
Go
18 lines
506 B
Go
package os
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// MustUserConfigDir generates a default config location for a user based on their OS. This location can be used to store
|
|
// any artefacts the app needs for its functioning. It is a pure function. Its only side effect is that results vary
|
|
// depending on which operative system we're in.
|
|
func MustUserConfigDir(prefix, extension string) string {
|
|
dir, err := os.UserConfigDir()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return filepath.Join(dir, prefix, extension)
|
|
}
|