aides-repo-api/internal/services/taskservice/utils.go

21 lines
387 B
Go
Raw Normal View History

2024-12-12 13:27:07 +00:00
package taskservice
import (
"fmt"
"os"
)
func createSymlink(target, link string) error {
if _, err := os.Lstat(link); err == nil {
if err := os.Remove(link); err != nil {
return fmt.Errorf("failed to remove existing file or symlink: %w", err)
}
}
if err := os.Symlink(target, link); err != nil {
return fmt.Errorf("failed to create symlink: %w", err)
}
return nil
}