void _DebugAnsiFileWrite( LPCSTR szRemark ) { if( !bDebug ) return; if (hDebug == INVALID_HANDLE_VALUE) { TCHAR szFile[] = _T("NRage-Debug.txt"); TCHAR szBuffer[MAX_PATH+1]; GetAbsoluteFileName( szBuffer, szFile, DIRECTORY_LOG ); hDebug = CreateFile( szBuffer, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); if (hDebug != INVALID_HANDLE_VALUE) SetFilePointer(hDebug, 0, 0, FILE_END); } if( hDebug != INVALID_HANDLE_VALUE ) { DWORD dwWritten; LPCSTR szText = szRemark; if( szText == NULL ) szText = "\r\n"; LPCSTR szCurrPos = szText; while( ( szCurrPos = strchr( szCurrPos, '\n' )) != NULL ) { DWORD length = szCurrPos - szText; if( length > 0 && szCurrPos[-1] == '\r' ) --length; if( length > 0 ) WriteFile( hDebug, (LPCVOID)szText, length, &dwWritten, NULL ); WriteFile( hDebug, "\r\n", 2, &dwWritten, NULL ); szText = ++szCurrPos; } DWORD length = lstrlenA( szText ); if( length > 0 ) WriteFile( hDebug, (LPCVOID)szText, length, &dwWritten, NULL ); } return; }
bool DialogInputFileNameForm::CheckInput() { //If the file in input is empty if(m_pAbsoluteFileNameLine->text().isEmpty()) { QMessageBox::warning(this, "Input error", "The input file cannot be empty"); return false; } //If the file hasn't an absolute path if(!(QFileInfo(GetAbsoluteFileName()).isAbsolute())) { QMessageBox::warning(this, "Input error", "The input file hasn't an absolute path.\n\n" "The file must have an absolute path."); return false; } //No error found return true return true; }