Added more stuff

This commit is contained in:
2025-10-27 22:51:42 +01:00
parent 4d6c354436
commit 4bc2f2ab50
7 changed files with 224 additions and 0 deletions

22
shared/files.go Normal file
View File

@@ -0,0 +1,22 @@
package shared
import (
"os"
"path/filepath"
"strings"
)
func FileNameWithoutExt(fileName string) string {
return strings.TrimSuffix(fileName, filepath.Ext(fileName))
}
func FileExists(filePath string) (bool, error) {
info, err := os.Stat(filePath)
if err == nil {
return !info.IsDir(), nil
}
if os.IsNotExist(err) {
return false, nil
}
return false, err
}