www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.file: isfile/isdir

reply vathixSpamFix dprogramming.com (Vathix) writes:
Functions isfile() and isdir() from std.file test if the name is a file or 
directory, but if the file or directory doesn't exist they throw an exception. 
I'd say it's not a file or directory if it doesn't even exist. Well, I don't 
mind the current behavior if it would specify this in phobos.html; and I 
suggest adding another function exists().


-- 
Christopher E. Miller
May 07 2004
next sibling parent reply C <qbert atari-soldiers.com> writes:
Ughh, are you serious it throws an exception ?

Can we please change this to return boolean ?

Phobos has become a seriously crippling element for the D language.  But 
im done preaching (begging?), ive shouted myself hoarse. What a shame.

Charles

On Fri, 7 May 2004 16:26:51 +0000 (UTC), Vathix 
<vathixSpamFix dprogramming.com> wrote:

 Functions isfile() and isdir() from std.file test if the name is a file 
 or
 directory, but if the file or directory doesn't exist they throw an 
 exception.
 I'd say it's not a file or directory if it doesn't even exist. Well, I 
 don't
 mind the current behavior if it would specify this in phobos.html; and I
 suggest adding another function exists().
May 07 2004
parent reply Andy Friesen <andy ikagames.com> writes:
C wrote:

 Ughh, are you serious it throws an exception ?
 
 Can we please change this to return boolean ?
 
 Phobos has become a seriously crippling element for the D language.  But 
 im done preaching (begging?), ive shouted myself hoarse. What a shame.
 
 Charles
I think this is the correct behaviour. Asking the OS for information about something that isn't there at all sounds exceptional to me. It's generally better for a program to explode spectacularly than to subtly fail in the face of oversight. It's not at all unrealistic to suppose that someone might write something like this: if (isfile(fileName) { .... } else { // assume it is a directory .... } -- andy
May 07 2004
parent reply "Unknown W. Brackets" <unknown at.simplemachines.dot.org> writes:
Andy Friesen wrote:

 I think this is the correct behaviour.  Asking the OS for information 
 about something that isn't there at all sounds exceptional to me.
 
 It's generally better for a program to explode spectacularly than to 
 subtly fail in the face of oversight.  It's not at all unrealistic to 
 suppose that someone might write something like this:
 
    if (isfile(fileName) {
       ....
    } else {
       // assume it is a directory
       ....
    }
 
  -- andy
Not always. I am mentioning it again, and it's not even a compiled language, but PHP handles this differently for good reason. Basically, because PHP supports streams (ssl://, http://, zlib://, ftp://, etc.) it's possible you could get your hands on a variable that contains a URL. The is_file() function returns if this is a *regular filesystem* file... and, similarly, the is_link() function returns if it is a *regular filesystem* symbolic link. (whereas file_exists() might work over zlib:// and tell you if the file exists as a gzip, etc. or under ftp:// the normal way.) But, assuming there is a function like exists(), or file_exists(), etc. it would not be a problem at all. Either way, personally I see assuming that !file is dir as more of an oversight than using isfile on a non-existant path. -[Unknown]
May 07 2004
parent Andy Friesen <andy ikagames.com> writes:
Unknown W. Brackets wrote:

    if (isfile(fileName) {
       ....
    } else {
       // assume it is a directory
       ....
    } 
Either way, personally I see assuming that !file is dir as more of an oversight than using isfile on a non-existant path.
That's exactly what I meant, actually. If it isn't a bug, it sure looks like one to me. If it is, then it would be preferable for the program to instantly explode with a line number and a good error message. -- andy
May 07 2004
prev sibling next sibling parent "Walter" <newshound digitalmars.com> writes:
"Vathix" <vathixSpamFix dprogramming.com> wrote in message
news:c7gdca$orb$1 digitaldaemon.com...
 Functions isfile() and isdir() from std.file test if the name is a file or
 directory, but if the file or directory doesn't exist they throw an
exception.
 I'd say it's not a file or directory if it doesn't even exist. Well, I
don't
 mind the current behavior if it would specify this in phobos.html; and I
 suggest adding another function exists().
I thought there was an exists() function already, but there isn't. You're right, there needs to be one.
May 07 2004
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
I've attached the overlooked function.


begin 666 file.d

M"B\O($%L;"!2:6=H=', 4F5S97)V960-"B\O('=W=RYD:6=I=&%L;6%R<RYC

M8RYS=&1I;SL-"G!R:79A=&4 :6UP;W)T('-T9"YP871H.PT*<')I=F%T92!I
M;7!O<G0 <W1D+G-T<FEN9SL-" T*+RHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ

M8V5P=&EO; T*>PT*("  ('!R:79A=&4 :6UP;W)T('-T9"YS>7-E<G)O<CL-
M" T*("  ('5I;G0 97)R;F\["0D)+R\ ;W!E<F%T:6YG('-Y<W1E;2!E<G)O

M*&YA;64L(")F:6QE($DO3R(I.PT*("  ('T-" T*("  ('1H:7,H8VAA<EM=
M(&YA;64L(&-H87);72!M97-S86=E*0T*("  ('L-" ES=7!E<BAN86UE('X 
M(CH (B!^(&UE<W-A9V4I.PT*("  ('T-" T*("  ('1H:7,H8VAA<EM=(&YA




M/3T]/3T]/3T]/3T]/3T](%=I;C,R(#T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]




M="!T:&4 5R!F=6YC=&EO;G,-"B  ("!U<V579G5N8W, /2 H1V5T5F5R<VEO
M;B I(#P



M("  1%=/4D0 ;G5M<F5A9#L-"B  ("!(04Y$3$4 :#L-"B  ("!B>71E6UT 

M;65Z(#T <W1D+G5T9BYT;U541C$V>BAN86UE*3L-" EH(#T 0W)E871E1FEL
M95<H;F%M97HL1T5.15))0U]214%$+$9)3$5?4TA!4D5?4D5!1"QN=6QL+$]0




M24Q%7U-(05)%7U)%040L;G5L;"Q/4$5.7T5825-424Y'+ T*"2  ("!&24Q%
M7T%45%))0E5415].3U)-04P ?"!&24Q%7T9,04=?4T51545.5$E!3%]30T%.
M+&-A<W0H2$%.1$Q%*6YU;&PI.PT*("  ('T-" T*("  (&EF("AH(#T]($E.
M5D%,241?2$%.1$Q%7U9!3%5%*0T*"6=O=&\ 97)R,3L-" T*("  ('-I>F4 
M/2!'971&:6QE4VEZ92AH+"!N=6QL*3L-"B  ("!I9B H<VEZ92 ]/2!)3E9!

M8GET95MS:7IE73L-" T*("  (&EF("A296%D1FEL92AH+&)U9BQS:7IE+"9N




M8G5F.PT*97)R,3H-"B  ("!T:')O=R!N97< 1FEL945X8V5P=&EO;BAN86UE

M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BH-"B J(%=R:71E(&$ 9FEL92X-

M*&-H87);72!N86UE+"!V;VED6UT 8G5F9F5R*0T*>PT*("  ($A!3D1,12!H

M*0T*("  ('L-" EW8VAA<BH ;F%M97H /2!S=&0N=71F+G1O551&,39Z*&YA


M04P ?"!&24Q%7T9,04=?4T51545.5$E!3%]30T%.+&-A<W0H2$%.1$Q%*6YU



M0E5415].3U)-04P ?"!&24Q%7T9,04=?4T51545.5$E!3%]30T%.+&-A<W0H
M2$%.1$Q%*6YU;&PI.PT*("  ('T-"B  ("!I9B H:" ]/2!)3E9!3$E$7TA!
M3D1,15]604Q512D-" EG;W1O(&5R<CL-" T*("  (&EF("A7<FET949I;&4H
M:"QB=69F97(L8G5F9F5R+FQE;F=T:"PF;G5M=W)I='1E;BQN=6QL*2 A/2 Q
M*0T*"6=O=&\ 97)R,CL-" T*("  (&EF("AB=69F97(N;&5N9W1H("$](&YU


M("  ($-L;W-E2&%N9&QE*& I.PT*97)R. T*("  ('1H<F]W(&YE=R!&:6QE



M72!N86UE+"!V;VED6UT 8G5F9F5R*0T*>PT*("  ($A!3D1,12!H.PT*("  

M('L-" EW8VAA<BH ;F%M97H /2!S=&0N=71F+G1O551&,39Z*&YA;64I.PT*

M4$5.7T%,5T%94RP-" D ("  1DE,15]!5%1224)55$5?3D]234%,('P 1DE,
M15]&3$%'7U-%455%3E1)04Q?4T-!3BQC87-T*$A!3D1,12EN=6QL*3L-"B  

M86UE*3L-" EH(#T 0W)E871E1FEL94$H;F%M97HL1T5.15))0U]74DE412PP











M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BH-"B J(%)E

M(&-H87);72!T;RD-"GL-"B  ("!"3T],(')E<W5L=#L-" T*("  (&EF("AU


M<F5S=6QT(#T 36]V949I;&5!*'1O34)3>BAF<F]M*2P =&]-0E-Z*'1O*2D[





M97-U;'0 /2!$96QE=&5&:6QE5RAS=&0N=71F+G1O551&,39Z*&YA;64I*3L-

M*3L-"B  ("!I9B H(7)E<W5L="D-" ET:')O=R!N97< 1FEL945X8V5P=&EO

M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ* T*("H 

M86UE*0T*>PT*("  ($A!3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6YG


M<RD-"GL-"B  (" O+R!/;FQY(&YE960 =&\ 9&\ =&AI<R!I9B!A;GD 8VAA


M=6QT.PT*"2  ("!I;G0 :3L-" D ("  =V-H87(J('=S(#T <W1D+G5T9BYT

M=6QT:4)Y=&4H,"P ,"P =W,L("TQ+"!N=6QL+" P+"!N=6QL+"!N=6QL*3L-

M97-U;'0L(')E<W5L="YL96YG=& L(&YU;&PL(&YU;&PI.PT*"2  ("!A<W-E
M<G0H:2 ]/2!R97-U;'0N;&5N9W1H*3L-" D ("  <F5T=7)N(')E<W5L=#L-


M;&EN=7  /3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T *B\-" T*=F5R<VEO;B H


M*BHJ*BH-"B J(%)E860 82!F:6QE+ T*("H 4F5T=7)N<SH-"B J"6%R<F%Y


M(&EN="!F9#L-"B  ("!S=')U8W1?<W1A="!S=&%T8G5F.PT*("  (&)Y=&5;

M:6YG>BAN86UE*3L-"B  (" O+W!R:6YT9B B9FEL92YR96%D*"<E<R<I7&XB
M+&YA;65Z*3L-"B  ("!F9" ]('-T9"YC+FQI;G5X+FQI;G5X+F]P96XH;F%M

M("  (" O+W!R:6YT9B B7'1O<&5N(&5R<F]R+"!E<G)N;R ]("5D7&XB+&=E

M+R]P<FEN=&8H(EQT9FEL92!O<&5N961<;B(I.PT*("  (&EF("AS=&0N8RYL
M:6YU>"YL:6YU>"YF<W1A="AF9"P )G-T871B=68I*0T*("  ('L-"B  ("  
M("  +R]P<FEN=&8H(EQT9G-T870 97)R;W(L(&5R<FYO(#T )61<;B(L9V5T

M92 ]('-T871B=68N<W1?<VEZ93L-"B  ("!B=68 /2!N97< 8GET95MS:7IE
M73L-" T*("  (&YU;7)E860 /2!S=&0N8RYL:6YU>"YL:6YU>"YR96%D*&9D


M(&5R<FYO(#T

M9F0I(#T]("TQ*0T*("  ('L-" DO+W!R:6YT9B B7'1C;&]S92!E<G)O<BP 
M97)R;F\ /2 E9%QN(BQG971%<G)N;R I*3L-"B  ("  ("  9V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;F%M92!A(&1I<F5C=&]R>3\-


M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ

M87);72!P871H;F%M92D-"GL-"B  ("!I9B H<W1D+F,N;&EN=7 N;&EN=7 N

M=R!&:6QE17AC97!T:6]N*'!A=&AN86UE+"!G971%<G)N;R I*3L-"B  ("!]


M;VED(&UK9&ER*&-H87);72!P871H;F%M92D-"GL-"B  ("!I9B H<W1D+F,N





M*0T*>PT*("  (&EF("AS=&0N8RYL:6YU>"YL:6YU>"YR;61I<BAT;U-T<FEN

M;VXH<&%T:&YA;64L(&=E=$5R<FYO*"DI.PT*("  ('T-"GT-" T*+RHJ*BHJ
M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ



M"71H<F]W(&YE=R!&:6QE17AC97!T:6]N*")C86YN;W0 9V5T(&-W9"(L(&=E
M=$5R<FYO*"DI.PT*("  ('T-" T*("  (&EN="!L96YG=&  /2!S=&0N<W1R
M:6YG+G-T<FQE;BAP*3L-"B  ("!C:&%R6UT 8G5F(#T ;F5W(&-H87);;&5N
M9W1H73L-"B  ("!B=69;72 ]('!;," N+B!L96YG=&A=.PT*("  ('-T9"YC

M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ



/;G5L;#L-"GT-" T*?0T*
`
end
May 07 2004
parent reply "Vathix" <vathixSpamFix dprogramming.com> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:c7gkv5$160c$1 digitaldaemon.com...
 I've attached the overlooked function.
You're returning false if getting the file attributes fails, but a different error could have occured like due to permissions or disk failure. I think it should test, on failure if GetLastError() returns ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND; and something with errno for linux, I assume. Sorry for nitpicking :> -- Christopher E. Miller
May 07 2004
next sibling parent "Walter" <newshound digitalmars.com> writes:
"Vathix" <vathixSpamFix dprogramming.com> wrote in message
news:c7gnga$19im$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in message
 news:c7gkv5$160c$1 digitaldaemon.com...
 I've attached the overlooked function.
You're returning false if getting the file attributes fails, but a
different
 error could have occured like due to permissions or disk failure. I think
it
 should test, on failure if GetLastError() returns ERROR_FILE_NOT_FOUND or
 ERROR_PATH_NOT_FOUND; and something with errno for linux, I assume. Sorry
 for nitpicking :>
It's a good point, and I could argue it either way.
May 07 2004
prev sibling parent "Unknown W. Brackets" <unknown at.simplemachines.dot.org> writes:
Vathix wrote:

 You're returning false if getting the file attributes fails, but a different
 error could have occured like due to permissions or disk failure. I think it
 should test, on failure if GetLastError() returns ERROR_FILE_NOT_FOUND or
 ERROR_PATH_NOT_FOUND; and something with errno for linux, I assume. Sorry
 for nitpicking :>
 
Many other implementations simply say a file does not exist if you cannot access it too. It's called security through obscurity :P. (kidding) -[Unknown]
May 07 2004