www.digitalmars.com         C & C++   DMDScript  

D - Someone interested in directory contents

reply Helmut Leitner <leitner hls.via.at> writes:
I'm currently doing my first steps adapting an old but very useful of my
C toolkit functions that scans directories (optionally recursive) for 
directories and/or files fitting some file (wildcard) specification.

In D one of some of its call interfaces could look like this:
  
    char [][] files = DirFindFile('c:\dmd','*.d',DFF_FILES|DFF_RECURSIVE);

giving an array of d-sourcefiles in all parts of this directory tree.

    DirFindFileCall('c:\dmd','*.*',
        delegate int (char [] dir, char [] fnam, WIN32_FIND_DATA *b) 
        { 
            printf("%s%s\n",(char *)dir,(char *)fnam); 
        }    
       ,DFF_DIRS|DFF_RECURSIVE
    ); 

printing the directory tree.

It's one of the workhorses for me when I write command line tools.

If there is interest I would look a bit more at the overall quality 
(I've still to grok D string handling) and put it somewhere for download.

-- 
Helmut Leitner    leitner hls.via.at
Graz, Austria   www.hls-software.com
Apr 04 2003
parent reply Benji Smith <Benji_member pathlink.com> writes:
Please do post it. I'd be interested in downloading it.

Perhaps you can post it at opend.org.

Or, better yet, if you can figure out how to get D added to the "programming
languages" category at sourceforge.net, that would be a great place to post it.

Thanks,

--Benji Smith


In article <3E8D52D4.799413AE hls.via.at>, Helmut Leitner says...
I'm currently doing my first steps adapting an old but very useful of my
C toolkit functions that scans directories (optionally recursive) for 
directories and/or files fitting some file (wildcard) specification.

In D one of some of its call interfaces could look like this:
  
    char [][] files = DirFindFile('c:\dmd','*.d',DFF_FILES|DFF_RECURSIVE);

giving an array of d-sourcefiles in all parts of this directory tree.

    DirFindFileCall('c:\dmd','*.*',
        delegate int (char [] dir, char [] fnam, WIN32_FIND_DATA *b) 
        { 
            printf("%s%s\n",(char *)dir,(char *)fnam); 
        }    
       ,DFF_DIRS|DFF_RECURSIVE
    ); 

printing the directory tree.

It's one of the workhorses for me when I write command line tools.

If there is interest I would look a bit more at the overall quality 
(I've still to grok D string handling) and put it somewhere for download.

-- 
Helmut Leitner    leitner hls.via.at
Graz, Austria   www.hls-software.com

Apr 04 2003
parent reply Helmut Leitner <helmut.leitner chello.at> writes:
Benji Smith wrote:
 
 Please do post it. I'd be interested in downloading it.
 
 Perhaps you can post it at opend.org.

 Or, better yet, if you can figure out how to get D added to the "programming
 languages" category at sourceforge.net, that would be a great place to post it.

As far as I see, opend.org is not yet equipped as an source code repository. (and I'm sure Walter has better things to do than refine his website right now) But even if it were, I would hesitate to upload it in the current form because I don't think that it is significant and good enough for an official module. It's just my first try and I'm looking for feedback to learn faster. I'll post it at the wiki. Anything on the wiki can be taken to any official website at any time. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Apr 04 2003
parent Helmut Leitner <helmut.leitner chello.at> writes:
You can find it here:
   <http://www.wikiservice.at/wiki4d/wiki.cgi?HelmutLeitner/Snippets>

--
Helmut Leitner    leitner hls.via.at   
Graz, Austria   www.hls-software.com
Apr 04 2003