We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb6c94f commit 34bee45Copy full SHA for 34bee45
include/res_path.h
@@ -33,15 +33,11 @@ std::string getResourcePath(const std::string &sub_dir = ""){
33
std::cerr << "Error getting resource path: " << SDL_GetError() << std::endl;
34
return "";
35
}
36
- //The final part of the string should be bin/ so replace it with res/ to
37
- //get what the lessons use for the resource path
+ //We replace the last bin/ with res/ to get the the resource path
38
size_t pos = base_res.find_last_of("bin") - 2;
39
base_res = base_res.substr(0, pos) + "res" + PATH_SEP;
40
41
- if (sub_dir.empty()){
42
- return base_res;
43
- }
44
- return base_res + sub_dir + PATH_SEP;
+ return sub_dir.empty() ? base_res : base_res + sub_dir + PATH_SEP;
45
46
47
#endif
0 commit comments