I can't find a decent way to find out if a file path points is a directory. I am thinking of a waythat would tell if a string, like "C:\Windows\System32" or "C:\SomeFolder" is a path to a folder or not.

The only other way I know is calling CreateDirectory(), and then calling RemoveDirectory() if the first function returns 0 (meaning the folder exists).

Please help
Posted on 2003-06-04 18:53:51 by Paulicles the Philosopher
BOOL PathIsDirectory( LPCTSTR pszPath);

pszPath
Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to verify.

Returns TRUE if the path is a valid directory, or FALSE otherwise.

Minimum DLL Version shlwapi.dll version 4.71 or later
Posted on 2003-06-04 18:59:53 by gfalen
You must also try to SetCurrentDirectory, which would fail if path is file.
Posted on 2003-06-04 19:07:01 by comrade
[size=12]    invoke GetFileAttributes, pszPath

cmp eax, INVALID_FILE_ATTRIBUTES
je @isNotDir
test eax, FILE_ATTRIBUTE_DIRECTORY
jz @isNotDir
jmp @isDir[/size]
Posted on 2003-06-04 21:02:21 by iblis
Nice :alright:
Posted on 2003-06-04 21:22:52 by comrade
Possible use: FindFirstFile(pszPath + '\', ...) != INVALID_HANDLE_VALUE
Posted on 2003-06-09 03:55:18 by P2M