fgenesis / ttvfs

[old/obsolete] Tiny tree virtual file system - a small C++ library for app-internal VFS support. Like PhysicsFS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API question

IngwiePhoenix opened this issue · comments

Hey.

So, I am working on this build system, and I need to implement a function to list all files by a pattern. I.e. src/*.cxx becomes a list of .cxx files in src (string vector, or list, most probably). So to do that, I need dirname() and basename(). And here come my questions:

1: Does TTVFS have these? And if yes, where?
2: What are the files needed to get these functions? Do I need the whole ttvfs/ folder?

Oh, and the buildtool in progress: http://github.com/IngwiePhoenix/IceTea
I am at the point where I am creating the commands. So I need all sorts of file-system APIs...

Kind regards, Ingwie

Most of this should be in VFSTools.h:
Given a file name with full path, you can use these:
GetBaseNameFromPath()
StripLastPath()
But note they were not explicitly made for this purpose, so maybe you just write those yourself if necessary.
For wildcards there is a function you can use: WildcardMatch(). Just enumerate things and filter out what you want based on the wildcard. Should be simple. If you match the full name + path, you don't need dirname()/basename(), imho.

So in other words, WildcardMatch() does what I am looking for? So if I give it a pattern like: ./src/*.cpp
…would it return something like
./src/a.cpp
./src/b.cpp

because then, that is all I really need.
Am 02.08.2014 um 22:46 schrieb False.Genesis notifications@github.com:

Most of this should be in VFSTools.h:
Given a file name with full path, you can use these:
GetBaseNameFromPath()
StripLastPath()
But note they were not explicitly made for this purpose, so maybe you just write those yourself if necessary.
For wildcards there is a function you can use: WildcardMatch(). Just enumerate things and filter out what you want based on the wildcard. Should be simple. If you match the full name + path, you don't need dirname()/basename(), imho.


Reply to this email directly or view it on GitHub.

Almost. Wildcard matching is just for strings, added for convenience. So you still need to build the list yourself (use forEachFile + filter file names by wildcard)

Thats great! Which files do I need to include in my project to make the functions available?
Am 02.08.2014 um 23:55 schrieb False.Genesis notifications@github.com:

Almost. Wildcard matching is just for strings, added for convenience. So you still need to build the list yourself (use forEachFile + filter file names by wildcard)


Reply to this email directly or view it on GitHub.

Most of this should be in VFSTools.h:

^
Read. Also it's called "tiny" for a reason :p
Iteration and so on is in VFSDirView.h.
But it's all already included with <ttvfs.h>, so no need to do anything else.