Инициализация проекта

Стабильный рабочий проект.
This commit is contained in:
Falknat
2025-10-02 06:02:45 +07:00
commit 7a87617282
47 changed files with 6057 additions and 0 deletions

25
Backend/tools/AbsPatch.go Normal file
View File

@@ -0,0 +1,25 @@
package tools
import (
"fmt"
"os"
"path/filepath"
"strings"
)
// getAbsPath получает абсолютный путь с автоматической проверкой существования для файлов
func AbsPath(path string) (string, error) {
absPath, err := filepath.Abs(path)
if err != nil {
return "", fmt.Errorf("ошибка получения абсолютного пути: %v", err)
}
// Проверяем существование только для файлов (с расширением)
if strings.Contains(filepath.Base(absPath), ".") {
if _, err := os.Stat(absPath); os.IsNotExist(err) {
return "", fmt.Errorf("файл не найден: %s", absPath)
}
}
return absPath, nil
}