www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Path struct, and directory walker - filepath.d

reply S. <S._member pathlink.com> writes:
I haven't had time to finish this project, and I don't think I will.  The
attached file is the start of a struct for manipulating paths, and some classes
to foreach over a directory tree.  These are intended for linux.  If somebody
wants to pick these up and run with them go for it!  I retain no rights to these
modules.


begin 0644 filepath.d
M;6]D=6QE('-T9"YF:6QE<&%T:#L*<')I=F%T92!I;7!O<G0 <W1D+F,N;&EN
M=7 N;&EN=7 ["G!R:79A=&4 :6UP;W)T('-T9"YC+FQI;G5X+F5R<FYO.PIP
M<FEV871E(&EM<&]R="!S=&0N8RYS=&1L:6(["G!R:79A=&4 :6UP;W)T('-T
M9"YR96=E>'`["G!R:79A=&4 :6UP;W)T('-T9"YS=')I;F<["G!R:79A=&4 
M:6UP;W)T('-T9"YS=&1I;SL*" IU;FET=&5S='L*"GT*"E=A;&ME<B!W86QK
M*&-H87);72!P871H+"!C:&%R6UT <&%T=&5R;B`](&YU;&PL(&)O;VP 9&5P
M=&AF:7)S="`]('1R=64I"GL*("!I9BAD97!T:&9I<G-T(#T](&9A;'-E*0H 
M("` >PH ("` ("!R971U<FX ;F5W($9O<G=A<F1786QK97(H<&%T:"P <&%T
M=&5R;BD["B` ("!]"B` 96QS90H ("` >PH ("` ("!R971U<FX ;F5W($)A
M8VMW87)D5V%L:V5R*'!A=& L('!A='1E<FXI.PH ("` ?0H (`I]("`*"F-L
M87-S(%=A;&ME< I["B` 8VAA<EM=(')O;W0["B` 4F5G17AP(&UA=&-H97([
M" H (&)O;VP 8F%C:W=A<F1S.PH (&%L:6%S(&EN="!D96QE9V%T92AI;F]U
M="!0871H(&9I;&4I(&9O<F5A8VAD9SL*("`*("!T:&ES*&-H87);72!P871H
M+"!C:&%R6UT <&%T=&5R;BD*("!["B` ("!R;V]T(#T <&%T:#L*("` (&EF
M*"!P871T97)N("%I<R!N=6QL("D*("` ("` >PH);6%T8VAE<B`](&YE=R!2
M96=%>'`H<&%T=&5R;BP (B(I.PH ("` ("!]"B` ?0H*("!0871H6UT 9V5T
M1&ER3&ES="A0871H(&1I<G`I"B` >PH ("` 1$E2*B!C=7)$:7(["B` ("!D
M:7)E;G0J(&1P.PH ("` 4&%T:%M=(&-O;G1E;G1S.PH ("` "B` ("!C=7)$
M:7( /2!O<&5N9&ER*'1O4W1R:6YG>BAD:7)P+F9U;&QP871H*2D["B` ("!I
M9B  8W5R1&ER("%I<R!N=6QL("D*("` ("` >PH)=VAI;&4H("AD<"`](')E
M861D:7(H8W5R1&ER*2D (3T 8V%S="AD:7)E;G0J*6YU;&P *0H)("!["0H)
M("` (&-H87);72!D7VYA;64 /2`H9'`N9%]N86UE*5LP+BYS=')L96XH(&1P
M+F1?;F%M92E=.PH)("` (&EF*"`A("  9%]N86UE(#T]("(N(B!\?"!D7VYA
M;64 /3T (BXN(BD *0H)("` ("` >PH)"5!A=&  <"`](%!A=& H(%!A=& N
M:F]I;B  9&ER<"YF=6QL<&%T:"P 9%]N86UE("D *3L*"0EC;VYT96YT<R!^
M/2!P.PH)("` ("` ?0H)("!]" EC;&]S961I<BAC=7)$:7(I.PH):68H(&=E
M=$5R<FYO*"D /3T 14)!1$8 *0H)("![" D ("` =W)I=&5F;&XH(E=41CH 
M)7,B+"!D:7)P+F9U;&QP871H*3L*"2` ?0H ("` ("!]"B` ("!E;'-E"B` 
M("` ('L*"2\J" D ($5!0T-%4R!097)M:7-S:6]N(&1E;FEE9"X*"2` 14U&
M24Q%(%1O;R!M86YY(&9I;&4 9&5S8W)I<'1O<G, :6X =7-E(&)Y('!R;V-E
M<W,N" D ($5.1DE,12!4;V\ ;6%N>2!F:6QE<R!A<F4 8W5R<F5N=&QY(&]P
M96X :6X =&AE('-Y<W1E;2X*"2` 14Y/14Y4($1I<F5C=&]R>2!D;V5S(&YO
M="!E>&ES="P ;W( ;F%M92!I<R!A;B!E;7!T>2!S=')I;F<N" D ($5.3TU%
M32!);G-U9F9I8VEE;G0 ;65M;W)Y('1O(&-O;7!L971E('1H92!O<&5R871I
M;VXN" D ($5.3U1$25( ;F%M92!I<R!N;W0 82!D:7)E8W1O<GDN" DJ+PH)
M<W=I=&-H*"!G971%<G)N;R I("D*"2` >PH)("!C87-E($5!0T-%4SH*"2` 
M("!B<F5A:SL*"2` 9&5F875L=#H*"2` ("!W<FET969L;B B17)R;W( )60Z
M("5S(BP 9V5T17)R;F\H*2P 9&ER<"YF=6QL<&%T:"D[" D ('T*("` ("` 
M?0H ("` <F5T=7)N(&-O;G1E;G1S.PH ('T*("`*("!I;G0 ;W!!<'!L>2AF

M<R!&;W)W87)D5V%L:V5R(#H 5V%L:V5R"GL*("!T:&ES*&-H87);72!P871H
M+"!C:&%R6UT <&%T=&5R;BD*("!["B` ("!S=7!E<B  <&%T:"P <&%T=&5R
M;BD["B` ?0H*("!I;G0 ;W!!<'!L>2AF;W)E86-H9&< 9&<I"B` >PH ("` 
M:6YT('=A;&M&;W)W87)D*%!A=&  8W5R1&ER*0H ("` ("![" EI;G0 <F5T
M8V]D93L*"0H)<F5T8V]D92`](&1G*&-U<D1I<BD[" EI9BAR971C;V1E("$]

M=$1I<DQI<W0H8W5R1&ER*2`I" D ('L*"2` ("!I9B  <"YI<T1I<B I("D*
M"2` ("` ('L*"0ER971C;V1E(#T =V%L:T9O<G=A<F0H('` *3L*"2` ("` 
M('T 96QS92![" D)<F5T8V]D92`](&1G*"!P("D[" D ("` ("!]" D ("` 
M" D ("` :68H<F5T8V]D92`A/2`P*0H)("` ("` <F5T=7)N(')E=&-O9&4[

M<G=A<F0H(%!A=& H(')O;W0 *2D["B` ?0I]" H*8VQA<W, 0F%C:W=A<F17
M86QK97( .B!786QK97(*>PH ('1H:7,H8VAA<EM=('!A=& L(&-H87);72!P
M871T97)N*0H ('L*("` ('-U<&5R*"!P871H+"!P871T97)N*3L*("!]"B` 
M"B` :6YT(&]P07!P;'DH9F]R96%C:&1G(&1G*0H ('L*("` (&EN="!R971C
M;V1E.PH ("` "B` ("!I;G0 =V%L:T)A8VMW87)D*%!A=&  8W5R1&ER*0H 
M("` ("!["B` ("` ("`)9F]R96%C:"  4&%T:"!P.R!G971$:7),:7-T*&-U
M<D1I<BD *0H)("![" D ("` :68H('`N:7-$:7(H*2`I" D ("` ("![" D)
M<F5T8V]D92`]('=A;&M"86-K=V%R9"  <"`I.PH)("` ("` ?2!E;'-E('L*
M"0ER971C;V1E(#T 9&<H('` *3L*"2` ("` ('T*"2` ("`*"2` ("!I9BAR

M971C;V1E(#T 9&<H8W5R1&ER*3L*"6EF*')E=&-O9&4 (3T ,"D*"2` <F5T
M=7)N(')E=&-O9&4[" D*"7)E='5R;B`P.PH ("` ("!]" H ("` <F5T=7)N
M('=A;&M"86-K=V%R9"  4&%T:"  <F]O="`I*3L*("!]"GT*"G-T<G5C="!0
M871H"GL*("!C:&%R6UT 9G5L;'!A=& [" H (&-O;G-T(&-H87( 9&ER<V5P
M(#T )R\G.PH*("!S=')U8W1?<W1A="!S=&%T1&%T83L*"B` =F]I9"!S=&%T
M*"D*("!["B` ("!S=&0N8RYL:6YU>"YL:6YU>"YS=&%T*"!T;U-T<FEN9WHH
M9G5L;'!A=& I+"`F<W1A=$1A=&$ *3L*("!]"B` "B` =F]I9"!L<W1A=" I
M"B` >PH ("` <W1D+F,N;&EN=7 N;&EN=7 N;'-T870H('1O4W1R:6YG>BAF
M=6QL<&%T:"DL("9S=&%T1&%T82`I.PH ('T*"B` =F]I9"!I;G-U<F53=&%T
M*"D*("!["B` ("!I9BAS=&%T1&%T82`]/2!S=')U8W1?<W1A="YI;FET*0H 
M("` ("![" EL<W1A=" I.PH ("` ("!]"B` ?0H*("!B;V]L(&ES1&ER*"D*
M("!["B` ("!I;G-U<F53=&%T*"D["B` ("!R971U<FX *'-T871$871A+G-T
M7VUO9&4 )B!37TE&350I(#T](%-?249$25(["B` ?0H*("!B;V]L(&ES1FEL
M92 I"B` >PH ("` :6YS=7)E4W1A=" I.PH ("` <F5T=7)N("AS=&%T1&%T
M82YS=%]M;V1E("8 4U])1DU4*2`]/2!37TE&4D5'.PH ('T*("`*("!B;V]L
M(&ES3&EN:R I"B` >PH ("` 96YS=7)E4W1A=" I.PH ("` <F5T=7)N("AS
M=&%T1&%T82YS=%]M;V1E("8 4U])1DU4*2`]/2!37TE&3$Y+.PH ('T*("`*
M("!B;V]L(&ES4V]C:V5T*"D*("!["B` ("!E;G-U<F53=&%T*"D["B` ("!R
M971U<FX *'-T871$871A+G-T7VUO9&4 )B!37TE&350I(#T](%-?24933T-+
M.PH ('T*"B` +RL*("`O* H ("` 24U03$5-14Y4(%1(15-%(%=(14X 5T4 
M2$%612!!($1!5$5424U%($-,05-3"B` *B\*("!$871E5&EM92!A8V-E<W-4
M:6UE*"D*("![" H ('T*("`*("!$871E5&EM92!M;V1I9FEC871I;VY4:6UE
M*"D*("![" H ('T*("`*("!$871E5&EM92!C<F5A=&EO;E1I;64H*0H ('L*
M"B` ?0H ("LO" H ('-T871I8R!C:&%R6UT :F]I;B  8VAA<EM=(&)A<V4L
M(&-H87);72!A9&1I=&EO;B`I"B` >PH ("` 8VAA<EM=6UT =V]R9',[" H 
M("` =V]R9', ?CT 8F%S93L*("` ('=O<F1S('X](&%D9&ET:6]N.PH ("` 
M:68H(&)A<V5;)"TQ72`]/2!D:7)S97`I"B` ("` (')E='5R;B!S=&0N<W1R
M:6YG+FIO:6XH=V]R9',L("(B*3L*("` (&5L<V4 :68H(&%D9&ET:6]N6S!=
M(#T](&1I<G-E<"D*("` ("` <F5T=7)N(&%D9&ET:6]N.PH ("` 96QS90H 
M("` ("!R971U<FX <W1D+G-T<FEN9RYJ;VEN*'=O<F1S+"`B(B!^(&1I<G-E
M<"D["B` ?0H*("!S=&%T:6, 4&%T:"!O<$-A;&PH(&-H87);72!P871H("D*
M("!["B` ("!0871H(&YE=U!A=& ["B` ("!N97=0871H+F9U;&QP871H(#T 
A<&%T:#L*("` (')E='5R;B!N97=0871H.PH ('T*?0H*
`
end
Jul 13 2006
next sibling parent Georg Wrede <georg.wrede nospam.org> writes:
S. wrote:
 I haven't had time to finish this project, and I don't think I will.
 The attached file is the start of a struct for manipulating paths,
 and some classes to foreach over a directory tree.  These are
 intended for linux.  If somebody wants to pick these up and run with
 them go for it!  I retain no rights to these modules.
For somebody whose name I haven't seen here before, I have to say, I like the way you write D code. I'd like to take over, but there are younger and more talented -- and more Linux savvy guys here, to do it better. ---- FOR EVERYBODY ELSE: I bet there are thousands of guys reading this NG, who haven't made any noise or who haven't submitted code. I bet quite a few of you don't want to do it "because the code should be polished, look like written by some long time D expert", well commented, or otherwise "better than your own normal code". I want you guys to know, that the D community is glad to receive even half-written stuff, anytime you feel (like S did) that you don't have the time to "finish" it. (Be it a single class, a single method, half a module, or just a skeleton of a concept. Or just maybe a part of any of those.) ---- Besides, submitting code, or even fragments of code, is the way to get a permanent plaque in the Hall of Contributors. Compare that to those who have contributed to the syntax, the morale, the direction of development -- none of them will ever get mentioned anywhere, even after half a decade.
Jul 13 2006
prev sibling parent reply Derek Parnell <derek nomail.afraid.org> writes:
On Thu, 13 Jul 2006 17:56:54 +0000 (UTC), S. wrote:

 I haven't had time to finish this project, and I don't think I will.  The
 attached file is the start of a struct for manipulating paths, and some classes
 to foreach over a directory tree.  These are intended for linux.  If somebody
 wants to pick these up and run with them go for it!  I retain no rights to
these
 modules.
Nice. I can use this stuff. I'll post it to the Wiki ( http://www.prowiki.org/wiki4d/wiki.cgi?PublicCode/DirWalker )to allow access and updates. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 14/07/2006 11:14:46 AM
Jul 13 2006
parent S. <S._member pathlink.com> writes:
On 2006-07-13 18:35:10 -0700, Derek Parnell <derek nomail.afraid.org> said:

 On Thu, 13 Jul 2006 17:56:54 +0000 (UTC), S. wrote:
 
 I haven't had time to finish this project, and I don't think I will.  The
 attached file is the start of a struct for manipulating paths, and some classes
 to foreach over a directory tree.  These are intended for linux.  If somebody
 wants to pick these up and run with them go for it!  I retain no rights 
 to these
 modules.
Nice. I can use this stuff. I'll post it to the Wiki ( http://www.prowiki.org/wiki4d/wiki.cgi?PublicCode/DirWalker )to allow access and updates.
I made a typo. I fixed it on your wiki. The code needs linux.errno.d which I also posted. Hopefully that makes it into phobos. -S
Jul 13 2006