I'm trying to open a text file and it's opening perfectly on Windows, but on Linux I'm getting a "No such file or directory".
My project structure is as the following:
- project
----> builds/debug/executable
----> engine/src
----> game
----> ----> src
----> ----> resources (found on windows, but not linux)
On Windows, as long as the resources folder is in the same folder where the game's source folder, it opens.
But on Linux, no mater where I move the resources folder, it never finds. Not sure how Linux manages that and what's my best option.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
void Assets::LoadShader(const char* name, const char* vertexSrc, const char* fragSrc) {
std::ifstream vShaderFile;
std::ifstream fShaderFile;
vShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);
fShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try {
vShaderFile.open(vertexSrc);
fShaderFile.open(fragSrc);
std::stringstream vShaderStream, fShaderStream;
std::string vertexCodeStr, fragCodeStr;
vShaderStream << vShaderFile.rdbuf();
fShaderStream << fShaderFile.rdbuf();
vShaderFile.close();
fShaderFile.close();
}
catch (std::ifstream::failure& _e) {
std::cout << "Assets: Error Loading File: " << strerror(errno) << std::endl;
}
}
|
I've tried moving the folder to where the executable is, also where all the projects are...but nothing :(