Files
Seele/src/Engine/Asset/Asset.cpp
T

63 lines
1.1 KiB
C++
Raw Normal View History

2020-05-05 01:51:13 +02:00
#include "Asset.h"
using namespace Seele;
Asset::Asset()
2020-06-02 11:46:18 +02:00
: fullPath("")
, name("")
, parentDir("")
, extension("")
, status(Status::Uninitialized)
{
}
Asset::Asset(const std::filesystem::path& path)
: fullPath(std::filesystem::absolute(path))
, status(Status::Uninitialized)
{
fullPath.make_preferred();
parentDir = fullPath.parent_path();
name = fullPath.stem();
extension = fullPath.extension();
}
Asset::Asset(const std::string &directory, const std::string &fileName)
: Asset(std::filesystem::path(directory + fileName))
2020-05-05 01:51:13 +02:00
{
}
Asset::~Asset()
{
2020-06-02 11:46:18 +02:00
}
std::ifstream &Asset::getReadStream()
{
if(inStream.is_open())
{
return inStream;
}
inStream.open(fullPath);
return inStream;
}
std::ofstream &Asset::getWriteStream()
{
if(outStream.is_open())
{
return outStream;
}
outStream.open(fullPath);
return outStream;
}
std::string Asset::getFileName()
{
return name.generic_string();
}
std::string Asset::getFullPath()
{
return fullPath.generic_string();
}
std::string Asset::getExtension()
{
return extension.generic_string();
2020-05-05 01:51:13 +02:00
}