diff options
| author | Julian Hurst <ark@mansus.space> | 2022-12-08 18:34:25 +0100 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2022-12-08 18:34:25 +0100 |
| commit | 238d7a12de4ad095c297f214a76438110798208b (patch) | |
| tree | 104f42f9f4a1bfc8b3a32723091a229e384e50a4 /config.go | |
| download | autoindex-238d7a12de4ad095c297f214a76438110798208b.tar.gz | |
Initial commit
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/config.go b/config.go new file mode 100644 index 0000000..4b253c9 --- /dev/null +++ b/config.go @@ -0,0 +1,16 @@ +package main + +import ( + "os" + "path/filepath" +) + +func GetIndexPath() string { + dataDir := os.Getenv("XDG_DATA_HOME") + if dataDir == "" { + home := os.Getenv("HOME") + dataDir = filepath.Join(home, ".local", "share") + } + indexPath := filepath.Join(dataDir, "autoindex", "index.html") + return indexPath +} |
