Skip to content

Commit

Permalink
more loopfiles fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lsalzman committed May 19, 2013
1 parent ad168a2 commit eab1987
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/engine/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2649,12 +2649,16 @@ ICOMMAND(loopfiles, "rsse", (ident *id, char *dir, char *ext, uint *body),
identstack stack;
vector<char *> files;
listfiles(dir, ext[0] ? ext : NULL, files);
loopv(files)
loopvrev(files)
{
char *file = files[i];
bool redundant = false;
loopj(i) if(!strcmp(files[j], file)) { redundant = true; break; }
if(redundant) { delete[] files.removeunordered(i--); continue; }
if(redundant) delete[] files.removeunordered(i);
}
loopv(files)
{
char *file = files[i];
if(i)
{
if(id->valtype == VAL_STR) delete[] id->val.s;
Expand Down

0 comments on commit eab1987

Please sign in to comment.