Hello,
I'm working on a file import routine for my games editor. When for example loading a texture, I want to copy it to the the resource folder. This is my file copying function:
void FileCopy(const std::wstring& stInName, const std::wstring& stOutName)
{
std::ifstream ifs(stInName, std::ios::binary);
std::ofstream ofs(stOutName, std::ios::binary);
// todo: add description to the expcetions
if(!ifs.is_open())
{
throw fileException();
}
else if(!ofs.is_open())
{
throw fileException();
}
ofs << ifs.rdbuf();
}
Works fine as long as I specify input and output file as absolut paths, like "C:/Editor/Textures/Out.png", but if I want to use the relative path, like "../Textures/Out.png", it fails to open the output file. Is there any trick or something I left out, or do I really have to retrieve the applications absolute dir and manually convert the relative path? If so, is there any easy, existing solution?