Fix home resolution issue
This commit is contained in:
@@ -334,8 +334,13 @@ func preprocessInstructions(instructions []LinkInstruction, filename, workdir st
|
|||||||
|
|
||||||
// loadFromReference loads instructions from a referenced file
|
// loadFromReference loads instructions from a referenced file
|
||||||
func loadFromReference(fromFile, currentFile, workdir string, visited map[string]bool) ([]LinkInstruction, error) {
|
func loadFromReference(fromFile, currentFile, workdir string, visited map[string]bool) ([]LinkInstruction, error) {
|
||||||
|
// First convert home directory if it starts with ~
|
||||||
|
fromPath, err := ConvertHome(fromFile)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error converting home directory: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Convert relative paths to absolute paths based on the current file's directory
|
// Convert relative paths to absolute paths based on the current file's directory
|
||||||
fromPath := fromFile
|
|
||||||
if !filepath.IsAbs(fromPath) {
|
if !filepath.IsAbs(fromPath) {
|
||||||
currentDir := filepath.Dir(currentFile)
|
currentDir := filepath.Dir(currentFile)
|
||||||
fromPath = filepath.Join(currentDir, fromPath)
|
fromPath = filepath.Join(currentDir, fromPath)
|
||||||
|
|||||||
Reference in New Issue
Block a user