Fix unique invocation in string_array_t tidy

This commit is contained in:
Kp 2014-12-20 04:36:11 +00:00
parent 5aed22bfce
commit 2b2da39d84
2 changed files with 5 additions and 2 deletions

View file

@ -228,5 +228,5 @@ void string_array_t::tidy(std::size_t offset, int (*comp)( const char *, const c
std::sort(b, e, [](const char *a, const char *b) { return d_stricmp(a, b) < 0; });
// Remove duplicates
// Can't do this before reallocating, otherwise it makes a mess of things (the strings in the buffer aren't ordered)
ptr.erase(std::unique(b, e, comp), e);
ptr.erase(std::unique(b, e, [=](const char *a, const char *b) { return (*comp)(a, b) == 0; }), e);
}

View file

@ -1337,7 +1337,10 @@ struct browser
static void list_dir_el(void *vb, const char *, const char *fname)
{
browser *b = reinterpret_cast<browser *>(vb);
if ((!strcmp((PHYSFS_getRealDir(fname)==NULL?"":PHYSFS_getRealDir(fname)), b->view_path)) && (PHYSFS_isDirectory(fname) || (PHYSFSX_checkMatchingExtension(b->ext_list, fname)))
const char *r = PHYSFS_getRealDir(fname);
if (!r)
r = "";
if (!strcmp(r, b->view_path) && (PHYSFS_isDirectory(fname) || PHYSFSX_checkMatchingExtension(b->ext_list, fname))
#if defined(__MACH__) && defined(__APPLE__)
&& d_stricmp(fname, "Volumes") // this messes things up, use '..' instead
#endif