Skip to content
This repository has been archived by the owner on Oct 22, 2018. It is now read-only.

Commit

Permalink
remove PATHDIV
Browse files Browse the repository at this point in the history
  • Loading branch information
q66 committed Sep 18, 2015
1 parent c1b4b36 commit 535e47d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
8 changes: 4 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,9 @@ depend:
$(OBJDIR)/client/octa/shared/crypto.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh
$(OBJDIR)/client/octa/shared/geom.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh
$(OBJDIR)/client/octa/shared/glemu.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh
$(OBJDIR)/client/octa/shared/stream.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh
$(OBJDIR)/client/octa/shared/stream.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh ostd/ostd/filesystem.hh ostd/ostd/vector.hh ostd/ostd/string.hh ostd/ostd/array.hh
$(OBJDIR)/client/octa/shared/tools.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh
$(OBJDIR)/client/octa/shared/zip.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh
$(OBJDIR)/client/octa/shared/zip.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh ostd/ostd/filesystem.hh ostd/ostd/vector.hh ostd/ostd/string.hh ostd/ostd/array.hh
$(OBJDIR)/client/octa/engine/aa.o: octa/engine/engine.hh octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh octa/engine/world.hh octa/engine/octa.hh octa/engine/light.hh octa/engine/texture.hh octa/engine/bih.hh octa/engine/model.hh
$(OBJDIR)/client/octa/engine/bih.o: octa/engine/engine.hh octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh octa/engine/world.hh octa/engine/octa.hh octa/engine/light.hh octa/engine/texture.hh octa/engine/bih.hh octa/engine/model.hh
$(OBJDIR)/client/octa/engine/blend.o: octa/engine/engine.hh octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh octa/engine/world.hh octa/engine/octa.hh octa/engine/light.hh octa/engine/texture.hh octa/engine/bih.hh octa/engine/model.hh
Expand Down Expand Up @@ -734,7 +734,7 @@ $(OBJDIR)/client/octa/octaforge/of_lua.o: octa/shared/cube.hh ostd/ostd/types.hh
$(OBJDIR)/client/octa/gui/core.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/glexts.hh octa/shared/glemu.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh octa/engine/engine.hh octa/engine/world.hh octa/engine/octa.hh octa/engine/light.hh octa/engine/texture.hh octa/engine/bih.hh octa/engine/model.hh ostd/ostd/tuple.hh octa/gui/core.hh ostd/ostd/event.hh ostd/ostd/vector.hh ostd/ostd/string.hh ostd/ostd/vecmath.hh

$(OBJDIR)/server/octa/shared/crypto.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh
$(OBJDIR)/server/octa/shared/stream.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh
$(OBJDIR)/server/octa/shared/stream.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh ostd/ostd/filesystem.hh ostd/ostd/vector.hh ostd/ostd/string.hh ostd/ostd/array.hh
$(OBJDIR)/server/octa/shared/tools.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh
$(OBJDIR)/server/octa/engine/command.o: octa/engine/engine.hh octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh octa/engine/world.hh
$(OBJDIR)/server/octa/engine/server.o: octa/engine/engine.hh octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh octa/engine/world.hh
Expand All @@ -744,7 +744,7 @@ $(OBJDIR)/server/octa/octaforge/of_lua.o: octa/shared/cube.hh ostd/ostd/types.hh
$(OBJDIR)/server/octa/octaforge/of_logger.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh octa/octaforge/of_logger.hh octa/octaforge/of_lua.hh

$(OBJDIR)/master/octa/shared/crypto.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh
$(OBJDIR)/master/octa/shared/stream.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh
$(OBJDIR)/master/octa/shared/stream.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh ostd/ostd/filesystem.hh ostd/ostd/vector.hh ostd/ostd/string.hh ostd/ostd/array.hh
$(OBJDIR)/master/octa/shared/tools.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh
$(OBJDIR)/master/octa/engine/command.o: octa/engine/engine.hh octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh octa/engine/world.hh
$(OBJDIR)/master/octa/engine/master.o: octa/shared/cube.hh ostd/ostd/types.hh ostd/ostd/new.hh ostd/ostd/algorithm.hh ostd/ostd/functional.hh ostd/ostd/platform.hh ostd/ostd/memory.hh ostd/ostd/utility.hh ostd/ostd/type_traits.hh ostd/ostd/internal/tuple.hh ostd/ostd/range.hh ostd/ostd/initializer_list.hh octa/shared/tools.hh octa/shared/geom.hh octa/shared/ents.hh octa/shared/command.hh octa/shared/iengine.hh octa/shared/igame.hh
Expand Down
2 changes: 1 addition & 1 deletion src/octa/engine/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ void checkinput()

case SDL_DROPFILE: {
char *fname = event.drop.file;
char *mname = strrchr(fname, PATHDIV);
char *mname = strrchr(fname, ostd::PATH_SEPARATOR);
mname = mname ? (mname + 1) : fname;
char *ext = strrchr(mname, '.');
if (ext) {
Expand Down
32 changes: 17 additions & 15 deletions src/octa/shared/stream.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "cube.hh"

#include "ostd/filesystem.hh"

///////////////////////// character conversion ///////////////

#define CUBECTYPE(s, p, d, a, A, u, U) \
Expand Down Expand Up @@ -305,25 +307,25 @@ char *path(char *s)
if(!file) return s;
curpart = file+1;
}
for(char *t = curpart; (t = strpbrk(t, "/\\")); *t++ = PATHDIV);
for(char *t = curpart; (t = strpbrk(t, "/\\")); *t++ = ostd::PATH_SEPARATOR);
for(char *prevdir = NULL, *curdir = curpart;;)
{
prevdir = curdir[0]==PATHDIV ? curdir+1 : curdir;
curdir = strchr(prevdir, PATHDIV);
prevdir = curdir[0]==ostd::PATH_SEPARATOR ? curdir+1 : curdir;
curdir = strchr(prevdir, ostd::PATH_SEPARATOR);
if(!curdir) break;
if(prevdir+1==curdir && prevdir[0]=='.')
{
memmove(prevdir, curdir+1, strlen(curdir+1)+1);
curdir = prevdir;
}
else if(curdir[1]=='.' && curdir[2]=='.' && curdir[3]==PATHDIV)
else if(curdir[1]=='.' && curdir[2]=='.' && curdir[3]==ostd::PATH_SEPARATOR)
{
if(prevdir+2==curdir && prevdir[0]=='.' && prevdir[1]=='.') continue;
memmove(prevdir, curdir+4, strlen(curdir+4)+1);
if(prevdir-2 >= curpart && prevdir[-1]==PATHDIV)
if(prevdir-2 >= curpart && prevdir[-1]==ostd::PATH_SEPARATOR)
{
prevdir -= 2;
while(prevdir-1 >= curpart && prevdir[-1] != PATHDIV) --prevdir;
while(prevdir-1 >= curpart && prevdir[-1] != ostd::PATH_SEPARATOR) --prevdir;
}
curdir = prevdir;
}
Expand Down Expand Up @@ -371,7 +373,7 @@ bool fileexists(const char *path, const char *mode)
bool createdir(const char *path)
{
size_t len = strlen(path);
if(path[len-1]==PATHDIV)
if(path[len-1]==ostd::PATH_SEPARATOR)
{
static string strip;
path = copystring(strip, path, len);
Expand All @@ -396,9 +398,9 @@ size_t fixpackagedir(char *dir)
{
path(dir);
size_t len = strlen(dir);
if(len > 0 && dir[len-1] != PATHDIV)
if(len > 0 && dir[len-1] != ostd::PATH_SEPARATOR)
{
dir[len] = PATHDIV;
dir[len] = ostd::PATH_SEPARATOR;
dir[len+1] = '\0';
}
return len;
Expand Down Expand Up @@ -449,7 +451,7 @@ const char *addpackagedir(const char *dir)
static int len = strlen("media");
filter = strstr(filter, "media");
if(!filter) break;
if(filter > pdir && filter[-1] == PATHDIV && filter[len] == PATHDIV) break;
if(filter > pdir && filter[-1] == ostd::PATH_SEPARATOR && filter[len] == ostd::PATH_SEPARATOR) break;
filter += len;
}
packagedir &pf = packagedirs.add();
Expand All @@ -471,13 +473,13 @@ const char *findfile(const char *filename, const char *mode)
{
string dirs;
copystring(dirs, s);
char *dir = strchr(dirs[0]==PATHDIV ? dirs+1 : dirs, PATHDIV);
char *dir = strchr(dirs[0]==ostd::PATH_SEPARATOR ? dirs+1 : dirs, ostd::PATH_SEPARATOR);
while(dir)
{
*dir = '\0';
if(!fileexists(dirs, "d") && !createdir(dirs)) return s;
*dir = PATHDIV;
dir = strchr(dir+1, PATHDIV);
*dir = ostd::PATH_SEPARATOR;
dir = strchr(dir+1, ostd::PATH_SEPARATOR);
}
return s;
}
Expand All @@ -503,7 +505,7 @@ static int search_oct_path(lua_State *L) {
int mnlen = strlen(modname);
memcpy(mnpath, modname, mnlen + 1);
char *dot = mnpath;
while ((dot = strchr(dot, '.'))) *(dot++) = PATHDIV;
while ((dot = strchr(dot, '.'))) *(dot++) = ostd::PATH_SEPARATOR;

int nnotfound = 0;
lua_pushnil(L);
Expand Down Expand Up @@ -642,7 +644,7 @@ int listfiles(const char *dir, const char *ext, vector<char *> &files, int filte
copystring(dirname, dir);
path(dirname);
size_t dirlen = strlen(dirname);
while(dirlen > 1 && dirname[dirlen-1] == PATHDIV) dirname[--dirlen] = '\0';
while(dirlen > 1 && dirname[dirlen-1] == ostd::PATH_SEPARATOR) dirname[--dirlen] = '\0';
int dirs = 0;
if((flags&LIST_ROOT) && listdir(dirname, true, ext, files, filter)) dirs++;
string s;
Expand Down
2 changes: 0 additions & 2 deletions src/octa/shared/tools.hh
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,9 @@ static inline int bitscan(uint mask)

#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define PATHDIV '\\'

#else
#define __cdecl
#define PATHDIV '/'
#endif

#ifdef __GNUC__
Expand Down
8 changes: 5 additions & 3 deletions src/octa/shared/zip.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "cube.hh"

#include "ostd/filesystem.hh"

enum
{
ZIP_LOCAL_FILE_SIGNATURE = 0x04034B50,
Expand Down Expand Up @@ -231,7 +233,7 @@ static void mountzip(ziparchive &arch, vector<zipfile> &files, const char *mount
if(foundofm)
{
const char *ofmdir = foundofm;
while(--ofmdir >= f.name && *ofmdir != PATHDIV);
while(--ofmdir >= f.name && *ofmdir != ostd::PATH_SEPARATOR);
if(ofmdir < f.name || checkprefix(files, f.name, ofmdir + 1 - f.name))
{
if(ofmdir >= f.name)
Expand Down Expand Up @@ -561,8 +563,8 @@ int listzipfiles(const char *dir, const char *ext, vector<char *> &files)
{
if(strncmp(f.name, dir, dirsize)) continue;
const char *name = f.name + dirsize;
if(name[0] == PATHDIV) name++;
if(strchr(name, PATHDIV)) continue;
if(name[0] == ostd::PATH_SEPARATOR) name++;
if(strchr(name, ostd::PATH_SEPARATOR)) continue;
if(!ext) files.add(newstring(name));
else
{
Expand Down

0 comments on commit 535e47d

Please sign in to comment.