package file

import (
	"go_project/pkg/behaivor"
	"os"
)

// Verification of the existence of a program with an emergency termination in case of an error
func MustIsNotExist(filename string) (result bool) {
	_, err := os.Stat(filename)
	if err != nil {
		result = os.IsNotExist(err)
	} else {
		return false
	}
	if result == false {
		behaivor.Anxiety("Error checking the existence of the file", err)
	}
	return true
}

// Create a file with truncated data
func MustCreate(filename string) {
	file, err := os.Create(filename)
	behaivor.Anxiety("File creating error", err)
	file.Close()
}
