Skip to content

Commit 34bee45

Browse files
committed
Some compacting of the return for res_path
1 parent bb6c94f commit 34bee45

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

include/res_path.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,11 @@ std::string getResourcePath(const std::string &sub_dir = ""){
3333
std::cerr << "Error getting resource path: " << SDL_GetError() << std::endl;
3434
return "";
3535
}
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
36+
//We replace the last bin/ with res/ to get the the resource path
3837
size_t pos = base_res.find_last_of("bin") - 2;
3938
base_res = base_res.substr(0, pos) + "res" + PATH_SEP;
4039
}
41-
if (sub_dir.empty()){
42-
return base_res;
43-
}
44-
return base_res + sub_dir + PATH_SEP;
40+
return sub_dir.empty() ? base_res : base_res + sub_dir + PATH_SEP;
4541
}
4642

4743
#endif

0 commit comments

Comments
 (0)