refactor: replace fileutil with fsutil and local hashing

This commit is contained in:
Mathis Maquenne
2026-08-05 11:42:35 +02:00
parent 12dbbb5e10
commit dbb808f371
9 changed files with 110 additions and 119 deletions
+32
View File
@@ -0,0 +1,32 @@
package fsutil
import (
"fmt"
"os"
)
func EnsureDir(path string) error {
info, err := os.Stat(path)
if os.IsNotExist(err) {
return os.MkdirAll(path, 0755)
}
if err != nil {
return err
}
if !info.IsDir() {
return fmt.Errorf("file already exists at %s", path)
}
return nil
}
func Exists(path string) bool {
info, err := os.Stat(path)
return err == nil && !info.IsDir()
}
func Remove(path string) error {
if !Exists(path) {
return nil
}
return os.Remove(path)
}