janwas
6fbce9c355
- color: the sse codepath is now detected and activated from within color.cpp, which avoids making ia32 dependent on the color header. it's called from gamesetup!InitRenderer. - move VFSUtil::EnumDirEnts to vfs.cpp!vfs_dir_enum - allows it to be used from within lib/ without dependency on ps (annoying for other projects) This was SVN commit r3764.
44 lines
829 B
C++
Executable File
44 lines
829 B
C++
Executable File
#include "precompiled.h"
|
|
|
|
#include "VFSUtil.h"
|
|
#include "lib/res/file/vfs.h"
|
|
|
|
#include "CLogger.h"
|
|
#define LOG_CATEGORY "vfs"
|
|
|
|
#include <deque>
|
|
|
|
using namespace VFSUtil;
|
|
|
|
// Because I'm lazy, and it saves a few lines of code in other places:
|
|
bool VFSUtil::FindFiles (const CStr& dirname, const char* filter, FileList& files)
|
|
{
|
|
files.clear();
|
|
|
|
Handle dir = vfs_dir_open(dirname);
|
|
if (dir <= 0)
|
|
{
|
|
LOG(ERROR, LOG_CATEGORY, "Error opening directory '%s' (%lld)", dirname.c_str(), dir);
|
|
return false;
|
|
}
|
|
|
|
int err;
|
|
DirEnt entry;
|
|
while ((err = vfs_dir_next_ent(dir, &entry, filter)) == 0)
|
|
{
|
|
files.push_back(dirname+"/"+entry.name);
|
|
}
|
|
|
|
if (err != ERR_DIR_END)
|
|
{
|
|
LOG(ERROR, LOG_CATEGORY, "Error reading files from directory '%s' (%d)", dirname.c_str(), err);
|
|
return false;
|
|
}
|
|
|
|
vfs_dir_close(dir);
|
|
|
|
return true;
|
|
|
|
}
|
|
|