Skip to content

Commit 3287ff6

Browse files
author
Risto Toijala
committed
unix mods: change error to warning
Ignore failure to open directories that the filesystem gave us. There's nothing we can do about it. Also improve missing mod warning. Tiny style improvement.
1 parent 8109241 commit 3287ff6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

code/cmdline/cmdline.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,9 +1041,12 @@ char *cmdline_parm::str()
10411041
// dir must not contain a slash.
10421042
static SCP_vector<SCP_string> unix_get_single_dir_names(SCP_string parent, SCP_string dir)
10431043
{
1044+
SCP_vector<SCP_string> ret;
1045+
10441046
DIR *dp;
10451047
if ((dp = opendir(parent.c_str())) == NULL) {
1046-
Error(LOCATION, "Can't open directory '%s' -- %d", parent.c_str(), errno);
1048+
Warning(LOCATION, "Can't open directory '%s' when searching mod paths. Ignoring. errno=%d", parent.c_str(), errno);
1049+
return ret;
10471050
}
10481051

10491052
dirent *dirp;
@@ -1100,7 +1103,7 @@ static void handle_unix_modlist(char **modlist, int *len)
11001103
{
11011104
SCP_vector<SCP_string> this_mod_paths = unix_get_dir_names(".", cur_mod);
11021105
if (this_mod_paths.empty()) {
1103-
ReleaseWarning(LOCATION, "Can't find mod '%s'", cur_mod);
1106+
ReleaseWarning(LOCATION, "Can't find mod '%s'. Ignoring.", cur_mod);
11041107
}
11051108
mod_paths.insert(mod_paths.end(), this_mod_paths.begin(), this_mod_paths.end());
11061109
}
@@ -1109,7 +1112,7 @@ static void handle_unix_modlist(char **modlist, int *len)
11091112
size_t total_len = 0;
11101113
SCP_vector<SCP_string>::iterator ii, end = mod_paths.end();
11111114
for (ii = mod_paths.begin(); ii != end; ++ii) {
1112-
total_len += (*ii).length() + 1;
1115+
total_len += ii->length() + 1;
11131116
}
11141117

11151118
char *new_modlist = new char[total_len + 1];

0 commit comments

Comments
 (0)