示例#1
0
void MComponent::writeTargetCD( ContFile& mak )
{
    WFileName path;
    _filename.path( path, false );

    if( path.match( NULL, matchDir ) ) {
        path.concat( "\\" );
    }
    if( path.drive()[0] != '\0' && path.drive()[1] == ':' )
        mak.printf( " @%s\n", path.drive() );
    mak.printf( " cd %s\n", (const char*)path );
}
示例#2
0
bool MComponent::addFromMask( WFileName& search, WString& err )
{
    bool ok = true;
    WFileName asearch( search );
    asearch.absoluteTo( _filename );
    DIR* dir = opendir( asearch );
    if( !dir ) {
        err.printf( "no files found for '%s'", (const char*)search );
        ok = false;
    } else {
        for(;;) {
            struct dirent* ent = readdir( dir );
            if( !ent ) break;
            WFileName newfile( ent->d_name );
            newfile.setDrive( search.drive() );
            newfile.setDir( search.dir() );
//            newfile.toLower();
            if( !addFromFilename( newfile, err ) ) {
                ok = false;
                break;
            }
        }
        closedir( dir );
    }
    return( ok );
}
示例#3
0
static void getRelFname( HWND hwnd, const char *fname, WString *relname ) {
    WString              fullpath;
    GetFilesInfo        *info;
    WFileName            tgt;
    WFileName            filename;
    char                 drive[_MAX_DRIVE];
    char                 dir[_MAX_DIR];

    info = (GetFilesInfo *)GET_DLGDATA( hwnd );
    getFullFname( hwnd, fname, &fullpath );
    filename = fullpath.gets();
    _splitpath( info->tgt_file, drive, dir, NULL, NULL );
    if( !stricmp( drive, filename.drive() ) ) {
        formRelDir( filename.dir(), dir, relname );
        relname->concat( filename.fName() );
        relname->concat( filename.ext() );
    } else {
        *relname = fullpath.gets();
    }
}