Ok. But there are two things that encourage this false idea:Josef Templ wrote:This() is not intended to check for the existence of a directory.
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.