|
Previous Top Next |
Prototype: | (String pPath),Byte |
pPath | Path to check for validity. |
Returns | Returns true if the path is valid and exists, false if it does not exist or is not a path |
This method can be used to determine if a filename being checked is a valid filename or a pathname. Note however that for it to detect if it is a path or not the file or path must exist. If the path or file does not exist, the method will return false even if the pathname/filename is valid.
In modern operating systems it is perfectly legal to have a file that does not have an extension. For example:
C:\test\this
A problem arises if you need to determine if a specified string is a valid filename or a valid folder name. Is C:\test\this a folder or is it a file without extension? PathIsDir will determine that based on the attributes of the filename. It uses PathIsDirectoryA API to detemine the validity of the name as a path. If the name is a folder name the method returns true, otherwise it returns false. Note that the folder must exist for it to return true.
Note: This API is loaded from shell32.dll. This API may not exist on Windows 95 and Windows 98 machines without Internet Explorer 4.0. In that case it will simply return False when called.
Example:
ITS ITShellClass
Code
If ITS.PathIsDir('c:\documents and settings')
Message ('this path is a folder')
Else
Message ('this path is not a folder')
End
See also: