Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API question #5

Open
IngwiePhoenix opened this issue Aug 2, 2014 · 5 comments
Open

API question #5

IngwiePhoenix opened this issue Aug 2, 2014 · 5 comments

Comments

@IngwiePhoenix
Copy link

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

@fgenesis
Copy link
Owner

fgenesis commented Aug 2, 2014

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.

@IngwiePhoenix
Copy link
Author

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 [email protected]:

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.

@fgenesis
Copy link
Owner

fgenesis commented Aug 2, 2014

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)

@IngwiePhoenix
Copy link
Author

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 [email protected]:

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.

@fgenesis
Copy link
Owner

fgenesis commented Aug 2, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants