mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-23 01:14:46 +07:00
patch: search geodata at same dir with config first (#84)
This commit is contained in:
parent
b991653692
commit
11d792e6a9
@ -70,13 +70,13 @@ func (c *LocationFinder) GetLocationAsset(log *logrus.Logger, filename string) (
|
|||||||
// Search dirs.
|
// Search dirs.
|
||||||
var searchDirs []string
|
var searchDirs []string
|
||||||
folder := "dae"
|
folder := "dae"
|
||||||
location := os.Getenv("DAE_LOCATION_ASSET")
|
|
||||||
// check if DAE_LOCATION_ASSET is set
|
// check if DAE_LOCATION_ASSET is set
|
||||||
|
location := os.Getenv("DAE_LOCATION_ASSET")
|
||||||
if location != "" {
|
if location != "" {
|
||||||
// add DAE_LOCATION_ASSET to search path
|
// add DAE_LOCATION_ASSET to search path
|
||||||
searchDirs = []string{
|
searchDirs = append(searchDirs, location)
|
||||||
location,
|
// add /etc/dae to search path
|
||||||
}
|
searchDirs = append(searchDirs, c.externDirs...)
|
||||||
// additional paths for non windows platforms
|
// additional paths for non windows platforms
|
||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
searchDirs = append(
|
searchDirs = append(
|
||||||
@ -87,15 +87,16 @@ func (c *LocationFinder) GetLocationAsset(log *logrus.Logger, filename string) (
|
|||||||
}
|
}
|
||||||
searchDirs = append(searchDirs, c.externDirs...)
|
searchDirs = append(searchDirs, c.externDirs...)
|
||||||
} else {
|
} else {
|
||||||
|
// add /etc/dae to search path
|
||||||
|
searchDirs = append(searchDirs, c.externDirs...)
|
||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
// Search XDG data directories on non windows platform
|
// Search XDG data directories on non windows platform
|
||||||
searchDirs = append([]string{xdg.DataHome}, xdg.DataDirs...)
|
searchDirs = append(searchDirs, xdg.DataHome)
|
||||||
|
searchDirs = append(searchDirs, xdg.DataDirs...)
|
||||||
for i := range searchDirs {
|
for i := range searchDirs {
|
||||||
searchDirs[i] = filepath.Join(searchDirs[i], folder)
|
searchDirs[i] = filepath.Join(searchDirs[i], folder)
|
||||||
}
|
}
|
||||||
searchDirs = append(searchDirs, c.externDirs...)
|
|
||||||
} else {
|
} else {
|
||||||
searchDirs = append([]string{}, c.externDirs...)
|
|
||||||
// fallback to the old behavior of using only current dir on Windows
|
// fallback to the old behavior of using only current dir on Windows
|
||||||
pwd := "./"
|
pwd := "./"
|
||||||
if absPath, e := filepath.Abs(pwd); e == nil {
|
if absPath, e := filepath.Abs(pwd); e == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user