mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
Teach Finder to find more than just the first matching element
When the system class path contains more than one .jar, it is quite concievable that, say, 'META-INF/MANIFEST.MF' can be found in multiple class path elements. This commit teaches the working horse of class path inspection, the Finder class, how to continue the search at a given state. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
6c46fe3f1a
commit
1864180ea7
@ -168,6 +168,7 @@ class Finder {
|
||||
unsigned* length,
|
||||
bool tryDirectory = false) = 0;
|
||||
virtual const char* urlPrefix(const char* name) = 0;
|
||||
virtual const char* nextUrlPrefix(const char* name, void *&finderElementPtr) = 0;
|
||||
virtual const char* sourceUrl(const char* name) = 0;
|
||||
virtual const char* path() = 0;
|
||||
virtual void dispose() = 0;
|
||||
|
@ -908,7 +908,16 @@ class MyFinder: public Finder {
|
||||
}
|
||||
|
||||
virtual const char* urlPrefix(const char* name) {
|
||||
for (Element* e = path_; e; e = e->next) {
|
||||
void *finderElementPtr = NULL;
|
||||
return nextUrlPrefix(name, finderElementPtr);
|
||||
}
|
||||
|
||||
virtual const char* nextUrlPrefix(const char* name,
|
||||
void *&finderElementPtr)
|
||||
{
|
||||
Element *&e = reinterpret_cast<Element*&>(finderElementPtr);
|
||||
e = e ? e->next : path_;
|
||||
for (; e; e = e->next) {
|
||||
unsigned length;
|
||||
System::FileType type = e->stat(name, &length, true);
|
||||
if (type != System::TypeDoesNotExist) {
|
||||
|
Loading…
Reference in New Issue
Block a user