paths: skip the user search tier when there is no home directory

ConfigSearchDirs/DataSearchDirs/ExecutableSearchDirs (and therefore
core/config's Resolve/ResolveAll/LoadMerged) failed outright with
ErrNoHomeDirectory when HOME/USERPROFILE was unset, so a service
started without HOME could no longer find its working-directory or
/etc/<app> config -- a regression against the hand-rolled lookups
being migrated onto core, which just skipped the user location.
Missing-home now only drops the user tier from the search lists; the
canonical <Category>Dir() methods still report ErrNoHomeDirectory.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-09-22 22:24:51 +02:00
1 parent 72b656262d
commit e8bf23a064
7 files changed
+220 -57

No files matched your search

+38 -28
View File
@@ -128,26 +128,30 @@ func (r *Resolver) configLayersWindows() ([]layer, error) {
var user []layer
if r.app.Kind != core.Desktop {
local, err := r.windowsBase("LOCALAPPDATA")
if err != nil {
if err := skipMissingHome(err); err != nil {
return nil, err
}
user = append(user, layer{
path: r.applyRoot(windowsJoin(local.path, r.app.Name)),
source: local.source,
priority: PriorityUserLocal,
canonical: false,
})
if err == nil {
user = append(user, layer{
path: r.applyRoot(windowsJoin(local.path, r.app.Name)),
source: local.source,
priority: PriorityUserLocal,
canonical: false,
})
}
}
roaming, err := r.windowsBase("APPDATA")
if err != nil {
if err := skipMissingHome(err); err != nil {
return nil, err
}
user = append(user, layer{
path: r.applyRoot(windowsJoin(roaming.path, r.app.Name)),
source: roaming.source,
priority: PriorityUser,
canonical: true,
})
if err == nil {
user = append(user, layer{
path: r.applyRoot(windowsJoin(roaming.path, r.app.Name)),
source: roaming.source,
priority: PriorityUser,
canonical: true,
})
}
system, err := r.windowsSystemLayer(r.app.Name)
if err != nil {
return nil, err
@@ -161,16 +165,19 @@ func (r *Resolver) dataLayersWindows() ([]layer, error) {
if v, ok := r.overrideValue(DataPath); ok {
return []layer{{path: r.applyRoot(v.path), source: v.source, priority: PriorityUser, canonical: true}}, nil
}
var user []layer
local, err := r.windowsBase("LOCALAPPDATA")
if err != nil {
if err := skipMissingHome(err); err != nil {
return nil, err
}
user := []layer{{
path: r.applyRoot(windowsJoin(local.path, r.app.Name)),
source: local.source,
priority: PriorityUserLocal,
canonical: true,
}}
if err == nil {
user = []layer{{
path: r.applyRoot(windowsJoin(local.path, r.app.Name)),
source: local.source,
priority: PriorityUserLocal,
canonical: true,
}}
}
system, err := r.windowsSystemLayer(r.app.Name)
if err != nil {
return nil, err
@@ -182,16 +189,19 @@ func (r *Resolver) executableLayersWindows() ([]layer, error) {
if v, ok := r.overrideValue(BinPath); ok {
return []layer{{path: r.applyRoot(v.path), source: v.source, priority: PriorityUser, canonical: true}}, nil
}
var user []layer
local, err := r.windowsBase("LOCALAPPDATA")
if err != nil {
if err := skipMissingHome(err); err != nil {
return nil, err
}
user := []layer{{
path: r.applyRoot(windowsJoin(local.path, "Yetano", "bin")),
source: local.source,
priority: PriorityUserLocal,
canonical: true,
}}
if err == nil {
user = []layer{{
path: r.applyRoot(windowsJoin(local.path, "Yetano", "bin")),
source: local.source,
priority: PriorityUserLocal,
canonical: true,
}}
}
system, err := r.windowsSystemLayer("Yetano", "bin")
if err != nil {
return nil, err