aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/Asset.cpp
blob: 3d4df530792a9ceb78833411d78bdb53c0262a79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <filesystem>

#include "Asset.h"
#include "Exception.h"

using namespace crepe;
using namespace std;

Asset::Asset(const string & src) : src(src) {
	try {
		this->src = filesystem::canonical(src);
	} catch (filesystem::filesystem_error & e) {
		throw Exception("Asset error: %s", e.what());
	}
	this->file = ifstream(this->src, ios::in | ios::binary);
}

const istream & Asset::read() { return this->file; }

const char * Asset::canonical() const { return this->src.c_str(); }