38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package eve
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os/user"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
func GetLogDirectories() ([]string, error) {
|
|
// Given assumptions about log directories in the eve application
|
|
// installatin layout, simple method to retrieve folders for eve.
|
|
// We can extend this to branch for or register platform later
|
|
linuxPath := "~/.local/share/Steam/steamapps/compatdata/8500/pfx/drive_c/users/steamuser/My Documents/EVE/logs/"
|
|
// linuxPath := "~/.local/share/Steam/steamapps/compatdata/8500/pfx/drive_c/users/steamuser/My Documents/EVE/notreal/"
|
|
//TODO: if not linux
|
|
// load ini or settings file of locations?
|
|
// get result by probing install path for file system a bit.
|
|
path := linuxPath
|
|
var paths []string
|
|
|
|
if strings.HasPrefix(path, "~/") {
|
|
userName, _ := user.Current()
|
|
path = filepath.Join(userName.HomeDir, path[2:])
|
|
}
|
|
files, err := ioutil.ReadDir(path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
for _, f := range files {
|
|
|
|
if f.IsDir() {
|
|
paths = append(paths, f.Name())
|
|
}
|
|
}
|
|
return paths, nil
|
|
}
|