package file

import (
	"os"
	"path/filepath"
)

func GetFile(userName, filePath string) (*os.File, error) {

	// 获取main.go所在的目录
	currentDir, err := os.Getwd()
	if err != nil {
		return nil, err
	}

	baseDir := filepath.Join(currentDir, "file_library")

	fullFilePath := filepath.Join(baseDir, userName, filePath)

	file, err := os.Open(fullFilePath)
	if err != nil {
		return nil, err
	}

	return file, nil
}
