1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-11-25 03:24:57 +00:00

Refactor and document some stuff

This commit is contained in:
Timur Ismagilov
2021-05-11 13:33:00 +05:00
parent d69ce77251
commit a1852d363e
18 changed files with 141 additions and 101 deletions

View File

@@ -1,3 +1,4 @@
// Package files is used to get paths to different files Mycorrhiza uses. Also see cfg.
package files
import (
@@ -17,9 +18,20 @@ var paths struct {
fixedCredentialsJSON string
}
func TokensJSON() string { return paths.tokensJSON }
// TokensJSON returns a path to the JSON file where users' tokens are stored.
//
// Default path: $XDG_DATA_HOME/mycorrhiza/tokens.json
func TokensJSON() string { return paths.tokensJSON }
// RegistrationCredentialsJSON returns a path to the JSON file where registration credentials are stored.
//
// Default path: $XDG_DATA_HOME/mycorrhiza/registration.json
func RegistrationCredentialsJSON() string { return paths.registrationCredentialsJSON }
func FixedCredentialsJSON() string { return paths.fixedCredentialsJSON }
// FixedCredentialsJSON returns a path to the JSON file where fixed credentials are stored.
//
// There is no default path.
func FixedCredentialsJSON() string { return paths.fixedCredentialsJSON }
// CalculatePaths looks for all external paths and stores them. Tries its best to find any errors. It is safe it to call it multiple times in order to save new paths.
func CalculatePaths() error {