mirror of
https://github.com/derfenix/photocatalog.git
synced 2026-03-12 07:40:29 +03:00
22 lines
315 B
Go
22 lines
315 B
Go
package modes
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
type HardLink struct {
|
|
}
|
|
|
|
func (h HardLink) PlaceIt(sourcePath, targetPath string, mode os.FileMode) error {
|
|
if err := os.Link(sourcePath, targetPath); err != nil {
|
|
if os.IsExist(err) {
|
|
return nil
|
|
}
|
|
|
|
return fmt.Errorf("create hard link: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|