Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: emkay on January 17, 2015, 07:55:35 am
-
Hello everyone,
attached is a small patch to the http://scp.indiegames.us/mantis/view.php?id=3036 bug reported in Mantis.
It is a small issue related to Linux only (or possibly OSX as well).
As I don't have a Linux OS available for testing, could someone else please have a look at it?
Many thanks!
P.S.: As I'm fairly new to SCP coding, I'm well aware that this patch might not be what experienced SCP coders are looking for. I'm open for suggestions.
[attachment kidnapped by pirates]
-
Appreciate the patch! However, in light of how simple the other two related functions are, I had another idea that might make the function in question behave correctly and make it simpler at the same time, and follow something closer to the existing pattern. See the attached patch.
[attachment kidnapped by pirates]
-
I agree, yours is a much better solution.
Well, that's the thing if you're new to some big bunch of code - you hardly know where to start... :rolleyes:
EDIT: Btw, shouldn't there also be a line Assert(CF_TYPE_SPECIFIED(dir_type));
in cf_exists_full() and cf_exists_full_ext(), as there is in cf_exists()?
-
I was debating on even leaving it in cf_exists since the other two didn't have it, but decided that someone may have wanted that there for a specific reason. It might be useful to have in all three but I wasn't interested in attaching my name to any more functions in svn blame than necessary ;)
-
The reason for the assertion in the old code is because cf_create_default_path_string() requires it (even though cf_create_default_path_string() has its own assertion for the exact same thing). Since the new version doesn't call it directly, but instead goes through cf_find_file_location() (which allows it to search all directory types if it wants to), the assertion doesn't need to be there at all, just like it isn't for the other two.