1 Commits

Author SHA1 Message Date
ade7c4d2b2 Don't crash when referenced file not found 2025-11-09 19:27:45 +01:00

View File

@@ -1,6 +1,7 @@
package main
import (
"errors"
"fmt"
"os"
"path/filepath"
@@ -316,6 +317,10 @@ func preprocessInstructions(instructions []LinkInstruction, filename, workdir st
// This is a from reference - load the referenced file
fromInstructions, err := loadFromReference(instr.Source, filename, workdir, visited)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
LogError("Referenced file not found: %s (from %s), skipping", instr.Source, filename)
continue
}
return nil, fmt.Errorf("error loading from reference %s: %w", instr.Source, err)
}
result = append(result, fromInstructions...)
@@ -445,6 +450,8 @@ func ExpandPattern(source, workdir, target string) (links []LinkInstruction, err
if err != nil {
return nil, fmt.Errorf("error converting home directory in source %s: %w", source, err)
}
// Normalize path to convert backslashes to forward slashes before pattern processing
source = NormalizePath(source, workdir)
static, pattern := doublestar.SplitPattern(source)
if static == "" || static == "." {
static = workdir