#include "file_manager.h"
#include <fstream>
#include "zlog.h"
using namespace std;
namespace engineapi {
	void FileManager::Init()
	{
		std::filesystem::path path = std::filesystem::current_path();
		Mount("engine", path.string());
		Asset::__Init__();
	}
	void FileManager::Shutdown()
	{

	}
	string FileManager::RealPath(const PackagePath& pack_path)
	{
		string_view name = pack_path.ParsePackage();
		string_view pre_path = FindMountPath(name);
		if (name.empty() || pre_path.empty()) {
			return string(pack_path.path);
		}
		string path;
		path.reserve(pre_path.size() + pack_path.size() - name.size() - 1);
		path.append(pre_path);
		path.append(pack_path.path.substr(name.size() + 1));
		return path;
	}
}

