sqlparser/file.cpp
// Check if the path points to an existing file
Check if the path points to an existing file
Check if the path points to an existing file
bool File::IsFile(const char *path, size_t *size)
{
#ifdef WIN32
	struct _finddata_t fileInfo;
	int findHandle = _findfirst(path, &fileInfo); 
	if(findHandle == -1)
	{
		_findclose(findHandle);
		return false;
	}
	bool file = IsFile(&fileInfo);
	if(size != NULL)
		*size = fileInfo.size;
	_findclose(findHandle);
	return file;
#else
	struct stat fileInfo;
	if(stat(path, &fileInfo) != -1)
	{
		if(S_ISREG(fileInfo.st_mode))
		{
			if(size != NULL)
				*size = fileInfo.st_size;
			return true;
		}
	}
	return false;
#endif
}
bool File :: IsFile ( const char * path , size_t * size ) { #ifdef WIN32 struct _finddata_t fileInfo ; int findHandle = _findfirst ( path , & fileInfo ) ; if ( findHandle == -1 ) { _findclose ( findHandle ) ; return false ; } bool file = IsFile ( & fileInfo ) ; if ( size != NULL ) * size = fileInfo . size ; _findclose ( findHandle ) ; return file ; #else struct stat fileInfo ; if ( stat ( path , & fileInfo ) != -1 ) { if ( S_ISREG ( fileInfo . st_mode ) ) { if ( size != NULL ) * size = fileInfo . st_size ; return true ; } } return false ; #endif }
Check if the path points to an existing file
Check if the path points to an existing file
// check if a file or directory exists with this name // check for file // check that this is a file