func (f *FileBackend) Init(ctx context.Context, conf *BackendConfig, opts ...Option) error {
	f.conf = conf
	cleanPrefix := strings.TrimPrefix(f.conf.TargetURI, FileBackendPrefix+"://")
	if cleanPrefix == f.conf.TargetURI {
		return ErrInvalidURI
	}
	absLocalPath, err := filepath.Abs(cleanPrefix)
	if err != nil {
		log.AppLogger.Errorf("file backend: Error while verifying path %s - %v", cleanPrefix, err)
		return err
	}
	fi, err := os.Stat(absLocalPath)
	if err != nil {
		log.AppLogger.Errorf("file backend: Error while verifying path %s - %v", absLocalPath, err)
		return err
	}
	if !fi.IsDir() {
		log.AppLogger.Errorf("file backend: Provided path is not a directory!")
		return ErrInvalidURI
	}
	f.localPath = absLocalPath
	return nil
}
Init will initialize the FileBackend and verify the provided URI is valid/exists.
package backends
import (
	"context"
	"io"
	"os"
	"path/filepath"
	"strings"
	"github.com/someone1/zfsbackup-go/files"
	"github.com/someone1/zfsbackup-go/log"
)
const FileBackendPrefix = "file"
type FileBackend struct {
	conf      *BackendConfig
	localPath string
}