flat assembler
Message board for the users of flat assembler.
Index
> Windows > FindFiles recursive Goto page Previous 1, 2 |
Author |
|
hopcode 03 Feb 2010, 00:22
baldr wrote: How...will directories not matching *.asm pattern be found by FindFirst/NextFile? Quote: ...instead of pushing current directory on stack and scanning found subdirectory, enqueue it... One moment...if i understand right, you mean something like first creating a "memory snapshot" of the content of the current-dir, putting all node-items in a list/queue, than processing the queue... if so, that is a really nice idea... it could be the right solution... Thanks a lot, hopcode . . . |
|||
03 Feb 2010, 00:22 |
|
f0dder 03 Feb 2010, 02:27
The pseudocode for such an implementation is pretty simple - implementing it efficiently is left as an exercise for the reader . It doesn't have to be insanely efficient since you're I/O rather than CPU-bound, and normal systems won't have huge amounts of entries in a folder, nor super deeply nested. Still, it's fun to optimize things, isn't it?
Code: listfiles(startpath,mask,callback) { queue dirqueue; //queue is a FIFO structure: push_back() and pop_front(). dirqueue.push_back(startpath); while(!dirqueue.empty()) { currentpath = dirqueue.pop_front(); foreach(entry in getentries(currentpath, mask)) if(entry.isdir && !entry.isjunction) dirqueue.push_back(entry); // folder, proces later else callback(entry); // file, give to callback } } |
|||
03 Feb 2010, 02:27 |
|
baldr 03 Feb 2010, 06:57
f0dder wrote: FindFirstFile()/FindNextFile() change the current working directory f0dder wrote: How do you distinguish between hard- and symlink? |
|||
03 Feb 2010, 06:57 |
|
sinsi 03 Feb 2010, 07:02
I always liked the idea of getting an entire directory's entries first, then iterating. Helps with caching I thought...
|
|||
03 Feb 2010, 07:02 |
|
f0dder 03 Feb 2010, 07:14
sinsi wrote: I always liked the idea of getting an entire directory's entries first, then iterating. Helps with caching I thought... _________________ - carpe noctem |
|||
03 Feb 2010, 07:14 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.