Exemple #1
0
BOOL
DeleteMultipleFiles(
    LPSTR DirName,
    LPSTR FilePattern
    )
{
    char path[ DB_MAX_PATH_LENGTH ];
    WIN32_FIND_DATA FindFileData;
    HDIR FindHandle;

    sprintf( path, "%s" PATH_SEPARATOR "%s", DirName, FilePattern );

    if (fQuery) {
        BuildMsgRaw("'erase %s'\n", path);
        return( TRUE );
        }

    FindHandle = FindFirstFile( path, &FindFileData );
    if (FindHandle == (HDIR)INVALID_HANDLE_VALUE) {
        return( FALSE );
        }

    do {
        if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
            DeleteSingleFile( DirName, FindFileData.cFileName, TRUE );
            }
        }
    while (FindNextFile( FindHandle, &FindFileData ));

    FindClose( FindHandle );
    return( TRUE );
}
Exemple #2
0
BOOL
DeleteSingleFile(
    LPSTR DirName,
    LPSTR FileName,
    BOOL QuietFlag
    )
{
    char path[ DB_MAX_PATH_LENGTH * 2 + 1]; // ensure we have enough space for "DirName" + "\\" + "FileName"

    if (DirName) {
        sprintf( path, "%s" PATH_SEPARATOR "%s", DirName, FileName );
        }
    else {
        strcpy( path, FileName );
        }
    if (!QuietFlag && fQuery) {
        BuildMsgRaw("'erase %s'\n", path);
        return( TRUE );
        }

    return( DeleteFile( path ) );
}
Exemple #3
0
VOID
CheckIncludeForWarning(
    IN LPCSTR CompilandDir,
    IN LPCSTR CompilandName,
    IN LPCSTR IncluderDir,
    IN LPCSTR IncluderName,
    IN LPCSTR IncludeeDir,
    IN LPCSTR IncludeeName
    )
    {

    CHAR CompilandFullName[ MAX_PATH ];
    CHAR IncluderFullName[ MAX_PATH ];
    CHAR IncludeeFullName[ MAX_PATH ];

    assert( CompilandDir );
    assert( CompilandName );
    assert( IncluderDir );
    assert( IncluderName );
    assert( IncludeeDir );
    assert( IncludeeName );

    CombinePaths( CompilandDir, CompilandName, CompilandFullName );
    CombinePaths( IncluderDir,  IncluderName,  IncluderFullName  );
    CombinePaths( IncludeeDir,  IncludeeName,  IncludeeFullName  );

    _strlwr( CompilandFullName );
    _strlwr( IncluderFullName );
    _strlwr( IncludeeFullName );

    EnterCriticalSection(&LogFileCriticalSection);
    if ( IncFile ) {
        fprintf(
             IncFile,
             "%s includes %s" EOL,
             IncluderFullName,
             IncludeeFullName
             );
    }
    LeaveCriticalSection(&LogFileCriticalSection);
    
    if ( ShouldWarnInclude( CompilandFullName, IncludeeFullName )) {

        if ( strcmp( IncluderFullName, CompilandFullName ) == 0 ) {

            EnterCriticalSection(&LogFileCriticalSection);
            if ( WrnFile ) {

                fprintf(
                     WrnFile,
                     "WARNING: %s includes %s\n",
                     CompilandFullName,
                     IncludeeFullName
                     );
            }
            LeaveCriticalSection(&LogFileCriticalSection);
                        
            if ( fShowWarningsOnScreen ) {

                BuildMsgRaw(
                    "WARNING: %s includes %s\n",
                    CompilandFullName,
                    IncludeeFullName
                    );
                }
            }

        else {

            EnterCriticalSection(&LogFileCriticalSection);
            if ( WrnFile ) {

                fprintf(
                     WrnFile,
                     "WARNING: %s includes %s through %s\n",
                     CompilandFullName,
                     IncludeeFullName,
                     IncluderFullName
                     );
            }
            LeaveCriticalSection(&LogFileCriticalSection);            

            if ( fShowWarningsOnScreen ) {

                BuildMsgRaw(
                    "WARNING: %s includes %s through %s\n",
                    CompilandFullName,
                    IncludeeFullName,
                    IncluderFullName
                    );
                }
            }
        }
    }