From: Jonathan de Boyne Pollard on 12 Jan 2010 13:45 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> <blockquote cite="mid:8ffnk5p0r1gvd6mkvl4rvj9n6qrbtncoqt(a)4ax.com" type="cite"> <p wrap="">The first time with a pattern match of <code>*.*</code> [...]<br> </p> </blockquote> <p>Stop that. You're not writing a DOS program. This is Win32. Use <code>*</code> to match all files.</p> </body> </html>
From: Jonathan de Boyne Pollard on 12 Jan 2010 13:45 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> <blockquote cite="mid:cfafb951-6dfd-40d9-bb4b-43ef096dcd71(a)z41g2000yqz.googlegroups.com" type="cite"> <p wrap="">I'm not aware of any, and technically speaking, that wouldn't be enough information for the API to function 100% properly, for instance, sometimes <code>APICall("thisisatest.txt", "*1*")</code> should return true to match how <code>FindFirstFile</code> operates:<br> </p> </blockquote> <p>That functionality, dubiously useful as it may be, can be achieved outside of the wildcard matching function itself, by saving both long and short names from the first directory scan, and calling the wildcard matching function against both names. However, I strongly suspect that exactly emulating all of the longname/shortname quirks of <code>FindFirstFile()</code> isn't actually the desired behaviour in the first place, here, and "How do I stop <code>FindFirstFile()</code> from matching shortnames?" would have been the next question had this design choice proven to be unworkable.<br> </p> <p>The POSIX API function for doing this task is <code>fnmatch()</code>, by the way. If it isn't in Microsoft's POSIX subsystem (I haven't looked.), there's undoubtedly a port <em>somewhere</em>.<br> </p> <p>For what it's worth, I went down this same single-pass design route with my utilities. Three things militated against it. The first two don't apply to Win32. But the third was that it can actually be a significant benefit to tell the filesystem driver as much as possible about what directory entries one wants to filter out, especially if remote volumes are involved.<br> </p> </body> </html>
|
Pages: 1 Prev: Determining number of physical drives Next: ruas in the same console |