U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Core » Problem with DirectoryExists() in windows
Problem with DirectoryExists() in windows [message #21852] Mon, 08 June 2009 13:19 Go to previous message
koldo is currently offline  koldo
Messages: 3460
Registered: August 2008
Senior Veteran
Hello all

When using DirectoryExists() with a drive name like

DirectoryExists("c:\\")


it returns false.

Revising the code I have seen that FindFirstFileW("C:\\") return INVALID_HANDLE_VALUE.

Perhaps a way to solve this would be check if directory name is a drive, so the changed DirectoryExists() could be:

bool DirectoryExists(const char *name) {
#if defined(PLATFORM_WIN32)
	if (GetDriveType(name) != DRIVE_NO_ROOT_DIR) 
	    return true;
#endif
	FindFile ff(name);
	return ff && ff.IsDirectory();
}


Best regards
Koldo


Best regards
IƱaki
 
Read Message
Read Message
Previous Topic: [SOLVED] SHA1/MD5 encrypt example
Next Topic: EOL problem
Goto Forum:
  


Current Time: Mon Jun 29 08:15:00 GMT+2 2026

Total time taken to generate the page: 0.00542 seconds