Add support for hard links

This commit is contained in:
2024-08-15 22:44:03 +02:00
parent 595a11552c
commit b8e7bc3576
2 changed files with 9 additions and 1 deletions

View File

@@ -122,7 +122,12 @@ func (instruction *LinkInstruction) RunAsync(status chan (error)) {
}
}
err := os.Symlink(instruction.Source, instruction.Target)
var err error
if *hard {
err = os.Link(instruction.Source, instruction.Target)
} else {
err = os.Symlink(instruction.Source, instruction.Target)
}
if err != nil {
status <- fmt.Errorf("failed creating symlink between %s%s%s and %s%s%s with error %s%+v%s", SourceColor, instruction.Source, DefaultColor, TargetColor, instruction.Target, DefaultColor, ErrorColor, err, DefaultColor)
return