Files.dir.This never fails

User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Files.dir.This never fails

Post by Robert »

DGDanforth wrote:I'm interested!
The coding below contains the Mod & Docu files for two modules: CasketShlwapiDll & CasketShlwapiUtils.

The routine you want, I suspect, is "IF CasketShlwapiUtils.IsDirectory("D:\Fred\Bert\Harry", FALSE) THEN ...".

This returns TRUE if "D:\Fred\Bert\Harry" exists, and it is a directory rather than a non-directory file.

The Docu is more complicated than one would like because it has to cover the possibilities that:
1 - "D:\Fred\Bert\Harry" is a non-directory file.
2 - "D:\BlackBox\BlackBox.exe" IS a directory file !!!.

Code: Select all

StdCoder.Decode ..,1 ..q0....7eCTdENPM5vO3uPlvI9fQhPNZv95OMbvO99RT7FTvMfv9b
 8ONvR19QH9FN9PRtP7vMGIRy0.....geoBhgRiiwhYRA....qorGqLCJom4Y6.......f0.c1.
 ...
 1Ak...ul....58FTuPE,5TWyqlKrqKKrGrtumdGLmGorCquU2hgnRAXDFTvMUn7FTvMf1G2sET
 fPdPMHfP9fQbf9hOO9vR7ONbvMoedhgrRiioedFWUkTeoxhmhgnpZHZijJC7ONbvM0.,.S.Sz3
 E.0k,5TWyql.bnayKmKKqGomC5XzET1.PuP.MHT9N9ntumaU2,CJuyKtQC98P9PP7ONbXmb.2.
 gc9k2kSi.,E.cUGpmWLuOpoKqvCbHZiYpedhA704TeKKw.bHfEWUmL.6..D.Dj0E.CcIhgsNHT
 9N9ntQ8qorG4704D.CbB,708T1U.knX.T.zC02U..Hv.cU.ktAcoZimBhWhiohgnZcZRCY.2.Q
 32U.EDU.U,U.AcmBhVZB,S45.0ES9.I,AU0KyB.,Ub.,UOU.2.AU.Ue64VT.E.0t.UUB.8E,9z
 4U.EU6.EBU.U,E.I3k.E6V.Q,AUjU0Q,AUWU0Y,AUCU1Ikmj,6.YI2.I12U.U,2.I3E.6.t3w,
 M7c.7.1cZc.L.S,8E4UCU1w,AU04.8E0UMV0Q,s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yC.6.V2A.QU.UVag0MO1c.8ssH25uPPPP1fP7PNZvQRtId1.,Mw7ONh1.uGf.2
 Um10..o.6.K,563szPuH7OJNOF,765OMb1b8ONvR19QHPJdPONvQrN0Fd8,761ORd9OTfQ,dC,
 76ZuP3PNZ9R,7F,tE1PPVfM99PN96,76JN8PM0Fd8,F,aO,0GE0GE00IUU2YeA3P68J763MEhv
 PH9N366JN8PkYqIcyIdGJE0G,8EECJom42YugbUQcVRC.6FN9PN76jOORPEVPOrN1PM1VeITuE
 98FfeI986,tEZPN1X2BhmhgXZijNSJ76FNGR86VPMd9O,dC,NEZeI1OK,tHB8658G1eIH76p76
 3uHT8H9OERuCP66,dJ1eIP66,76,tQ9vM,76p76,tJH1umdKoVKJdaIeapj4IeGJdaIVKJeKod
 in40GE8oWSoYuo40GE.RdPNONRvNd9O,76,76.UugbU2YHBdOhcU2ZLBhi,...amRqEE0GEQCY
 hkReZRgpJidZitZcZRCZPOV9RTfQ,76pND2avgVU22UWBdi3hZJid7G1fP79P996,7600e1Spo
 .BOENuI9uCP66cI98JfeIR86,tJ.5eQ9PM.UL3Yc2iVZCN76bPNaGE0mF0WLBBEXUB2YUg60GE
 CIt..QbBg,w7.C26I19RFf8,78H066plU..iHEGLtaqqGpkaKq0GR0GV..00....c.wdJZeUQg
 iZiUIbUAdCZe3xc3JedQbB22h0kpmGEqKE0GR0GEaIbG3QbB22,llWKt0GE0GR0W13d,l4UnZi
 p76,dC,lU8JdEE4HNWHE0mbOIE0mV.I6.,llu4,dCvVk.,lUCpdKIdGJEWGs44ipMqZx2YbIbb
 YZUIakAZvgVUUf3YUIbx.,NP,76pNDgZlQbB22Ie33e3BcIhVU2YU66CKoUxEs4KukpqpRqEEE
 EAd43YUQgcVx2YUwYQxYU2YI37sMERkHymH0GEKIbQbB22,FEA7.q1D,G3MP,76kp0W3,22,lt
 UPRhR3YUI5QgctC,NGRuE,78LP8P66,76KJbGpYmIE0ml66EMWpRqEE22H0dfQH166d0Qio,PP
 L,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Bg,ZuH.Qcj3it,J76FNGQimRg
 CBghhgg2YYRiopdVhB,dC00A9TW1,0000..cMfPON9NVOMdHKAggZhjxiDpiZJirJidZiZ3Yu2
 Y0,A3.sCcJEEcPTvET9Q0GEeHEw8U0xdDZdvgVU66CKr22,76e1H0.82u2MGcMfHq.,76B76ur
 YCLWa4kw0GIGqtG5Y3deIfOFHN1,76,FEY8kV85MM687vQ.Ug2Y0IUUQgiZid2YUg6i10W7VVZ
 B..,7JUixB.vVL,o6.,FE...gcARe33YUohj,.j06JZOJ986,NF.Ie3,w8U1xhkBj4VL3YcQim
 RAUY,Ery4AZU2YX66.O2g,K2,lVy4B0rN1PkWuIW001vQ.keUigVBIUU22GomOLWKKlKrnumeu
 KqyqkGq48ssHpmsETfPdfQT9PNPNZvQRtIQcoJigZcZRiX3Ulb8..umVyKrG5EWKqt2.501PO.
 cQ...sQR,.G20EtH.0.G,0.aU.6.,..1cUXDJcIf9P9fQbf9bWGhigFWE.4Te.sQRdIf9PY62U
 mT.,U.kLl1kH1E.0E.0U1CSW5ktumdsIaLqKKWKqt2Ul1.RVtZBE.8z10E.6..F.x00.3Qw.EL
 4IuElU2V.6,6..Uc6.0k.0.0.0nMfJ.E.GT,5UAB94.4.6MT7BcUZ50E..US.,.1E.MEZPO19P
 0S45.2UEC.6..mEw7169rwKiEw3c0Cy2xBq4sET1.UJ.,..W.0.A,,UcRgn7Crsc0MyfU.az86
 uB9OWPDW7Ah,...
 --- end of encoding ---
Edited to replace Pac code by StdCoder - 14-12-2016
Last edited by Robert on Wed Dec 14, 2016 10:23 am, edited 2 times in total.
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Files.dir.This never fails

Post by DGDanforth »

Robert,

Please don't use Pac. I can't get your code to unpac.
Much too complicated. Just use Tools->Encode file list.

-Doug
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Files.dir.This never fails

Post by Josef Templ »

In the case of Locator.This there seems to be an inconsistency between the docu
and the implementation. HostFiles.Locator.This always returns # NIL and sets
the result code in the returned locator, not in the receiver as stated in the docu.
The implementation, if I read it correctly, is perfectly in line with
HostFiles.Directory.This, which is good news. The implementation needs no change
and hence there are no incompatibilities with running code.

I can imagine that there has been a change in the implementation of
HostFiles.Locator.This in the past but the docu has not been updated
accordingly. Consequently, not all invocations have been updated.

If this turns out to be true (please check the sources and the docu)
it would be justified to create an issue for fixing the docu and the checks
after Locator.This and Directory.This.

- Josef
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Files.dir.This never fails

Post by DGDanforth »

Josef Templ wrote:In the case of Locator.This there seems to be an inconsistency between the docu
and the implementation. HostFiles.Locator.This always returns # NIL and sets
the result code in the returned locator, not in the receiver as stated in the docu.
The implementation, if I read it correctly, is perfectly in line with
HostFiles.Directory.This, which is good news. The implementation needs no change
and hence there are no incompatibilities with running code.

I can imagine that there has been a change in the implementation of
HostFiles.Locator.This in the past but the docu has not been updated
accordingly. Consequently, not all invocations have been updated.

If this turns out to be true (please check the sources and the docu)
it would be justified to create an issue for fixing the docu and the checks
after Locator.This and Directory.This.

- Josef
I believe your analysis is correct (good catch on the receiver issue)

I suggest that BB1.8 changes the behavior of Files.dir.This
by adding a res parameter to the call thereby allowing a NIL
return for an invalid path (one that does not exist).
For consistency loc.This should also return NIL when the
relative path does not exist.
-Doug
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Files.dir.This never fails

Post by Robert »

DGDanforth wrote:Robert,

Please don't use Pac. I can't get your code to unpac.
Much too complicated. Just use Tools->Encode file list.

-Doug
Done
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Files.dir.This never fails

Post by Robert »

DGDanforth wrote:I suggest that BB1.8 changes the behavior of Files.dir.This
by adding a res parameter to the call thereby allowing a NIL
return for an invalid path (one that does not exist).
For consistency loc.This should also return NIL when the
relative path does not exist.
-Doug
I don't understand the necessity for this.
I think it is ok if "This" (usually) returns a Locator.
If the location is not found it should then set "loc.res" to 2 in accordance with the documentation.

This would mean no interface changes; the problem is the failure to set res to 2, and fixing this would break nothing.

Actually I think I see two other issues:
1 - Why is the set of result codes different for dir.This & loc.This ?
2 - If I call "Files.dir.This('D:\Fred\Henry')" what happens if 'D:\Fred\Henry' exists, but is an ordinary file, not a directory? The Docu implies no error, but I probably want a "Missing Directory" error.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Files.dir.This never fails

Post by Josef Templ »

Robert wrote: I don't understand the necessity for this.
I think it is ok if "This" (usually) returns a Locator.
If the location is not found it should then set "loc.res" to 2 in accordance with the documentation.

This would mean no interface changes; the problem is the failure to set res to 2, and fixing this would break nothing.
Attention: I think there is still a fundamental misunderstanding regarding the semantics of This().
This() is not intended to check for the existence of a directory.
It only checks for valid names.
Otherwise it would not be possible to create files in a new directory
without getting an error.

Setting res to 2 for non-existing directories would mean an incompatibility.
This is not in accordance with the docu, in my understanding.
It would also mean a file system operation for every This(), which has been
carefully avoided for relative paths.

The only option I see is to add a new function that tests for the
existence of a directory, if this is required.

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Files.dir.This never fails

Post by Ivan Denisov »

Locator is more general than just a directory on the hard disk, it can be file in RAM or some entry in database. So this is definitely not a bug...

I suggest to write small WinApi function for this
http://stackoverflow.com/questions/8233 ... and-winapi
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Files.dir.This never fails

Post by Robert »

Josef Templ wrote:This() is not intended to check for the existence of a directory.
Ok. But there are two things that encourage this false idea:

1 - The existence of the return code res = 2 meaning "location not found"
2 - Many examples where the calling code appears to use "loc = NIL" to test for the existence of a directory.

So, I suggest, we want three things:

1 - Clarify the Docu regarding This. Explain when res = 2 does, and does not, occur.
2 - Correct the calling code that misuses the loc = NIL test.
3 - Add a function to test for a directories' existence. (The code I posted earlier shows how to do this with a 1 line Windows call.)

Code: Select all

MODULE  CasketShlwapiDll ["shlwapi.dll"];
IMPORT  SYSTEM, Win := WinApi;

PROCEDURE  PathIsDirectoryW* (path : Win.PtrWSTR) : Win.BOOL;
END  CasketShlwapiDll.


MODULE  CasketShlwapiUtils;
IMPORT  Shlwapi := CasketShlwapiDll, WinApi;

PROCEDURE  IsDirectory* (path : ARRAY OF CHAR) : BOOLEAN;
  BEGIN
    RETURN  Shlwapi.PathIsDirectoryW (path)  #  WinApi.FALSE
  END  IsDirectory;
END  CasketShlwapiUtils.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Files.dir.This never fails

Post by Josef Templ »

Robert wrote: Ok. But there are two things that encourage this false idea:

1 - The existence of the return code res = 2 meaning "location not found"
2 - Many examples where the calling code appears to use "loc = NIL" to test for the existence of a directory.

So, I suggest, we want three things:

1 - Clarify the Docu regarding This. Explain when res = 2 does, and does not, occur.
2 - Correct the calling code that misuses the loc = NIL test.
3 - Add a function to test for a directories' existence. (The code I posted earlier shows how to do this with a 1 line Windows call.)
No question that the situation is confusing.
But note that the error code 2 is not listed as a result of This().
There is a global list of error codes for the purpose of
mapping error codes to error messages, for example.
This does not mean that all error codes can occur at all places
where error codes are set.
The docu already lists the error codes that can result from
a particular operation, with maybe a few inaccuracies, I don't know.

- Josef
Post Reply