#include "protoFile.h"
#include <stdio.h>
#ifdef WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
int main(int argc, char* argv[])
{
ProtoFile::PathList pathList;
for (int i = 1; i < argc; i++)
{
if (!pathList.AppendPath(argv[i]))
{
fprintf(stderr, "fileTest error: unable to append item\n");
return -1;
}
}
ProtoFile::PathList::PathIterator iterator(pathList, true);
char path[PATH_MAX + 1];
while (iterator.GetNextFile(path))
{
const ProtoFile::Path* parentPath = iterator.GetCurrentPathItem();
printf("1st iteration to \"%s\" (parentPath: %s )\n", path, parentPath->GetPath());
}
fprintf(stderr, "fileTest: sleeping 5 seconds before 2nd iteration for updated files\n");
#ifdef WIN32
Sleep(5000);
#else
sleep(5); #endif
iterator.Reset();
while (iterator.GetNextFile(path))
printf("2nd iteration to \"%s\"\n", path);
iterator.Init(true);
}