Beispiel #1
0
bool FileSystemManager::resolveVolume( DEV_BROADCAST_HDR * data, QList<QString>& volumesOut )
{
	// only handle logical volumes
	if (data->dbch_devicetype == DBT_DEVTYP_VOLUME)
	{
		DEV_BROADCAST_VOLUME * volume = (DEV_BROADCAST_VOLUME *) data;
		if (volume->dbcv_flags != DBTF_NET)
		{
			// not a network volume
			// so get the drive letter
			static QString driveLetters("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
			for (int i = 0; i < driveLetters.size(); ++i)
			{
				if (volume->dbcv_unitmask & (1 << i))
				{
					QString driveLetter(1, driveLetters[i]);
					driveLetter += ":\\";
					volumesOut.append(driveLetter);
				}
			}
			if (!volumesOut.isEmpty())
				return true;
		}
	}
	return false;
}
// ---------------------------------------------------------
// CCookieManagerServer::CheckDiskSpace
// ---------------------------------------------------------
//
TBool CCookieManagerServer::CheckDiskSpace( RFs& aFileSystem,
										   const TDesC& aFileName ) const
	{
	TInt err;

	TParse parse;
	err = parse.SetNoWild( aFileName, NULL, NULL );
	if ( err == KErrNone )
		{
		// This is in the form : drive-letter: (letter + semi-colon)
		TBuf<2> driveBuf( parse.Drive() );
		TCharF driveLetter( driveBuf[0] );
		TCharF driveALetter( 'A' );
		TDriveNumber driveNum = (TDriveNumber)( (TUint)(driveLetter) -
												(TUint)(driveALetter) );

		TBool noSpace = EFalse;
		TRAP( err, noSpace = SysUtil::DiskSpaceBelowCriticalLevelL
					( &aFileSystem, KCookieMaxFileLength, driveNum ) );
		if ( err == KErrNone && noSpace )
			{
			err = KErrDiskFull;
			}
		}

	return ( err == KErrNone ? ETrue : EFalse );
	}
QString WidgetDigSignValidation::getRootDirectory( const QString& rootDirectory, const QString& processUid )
{
    QString result = NULL;
    QChar driveLetter(NULL);
    
    if ( rootDirectory.length() >= 1 ) 
    {
        driveLetter = rootDirectory[0];
        if (!driveLetter.isLetter())
            return QString();

        // Handle edge case when only drive letter is available from rootDirectory (and no subdirectories) 
        else if (rootDirectory.length() <= strlen("A:\\")) 
                result = QDir::toNativeSeparators( QString(driveLetter) + QDir::separator() + PrivateDirectory + QDir::separator() + processUid );
                
        // Use the passed driveletter and root dir
        else
        {
            QString rootDrive = rootDirectory;
            if (!(rootDrive.startsWith("\\") || rootDrive.startsWith("/")))
                rootDrive.remove(0, 2);
            QString rootPath = "";
            rootPath.append(driveLetter);
            rootPath = rootPath+':'+rootDrive;
            rootPath = QDir::toNativeSeparators(rootPath);
            result = rootPath;
        }
    } 
    else 
    {
        if (driveLetter.isNull()) {
            result = DefaultDrive + QDir::separator() + PrivateDirectory + QDir::separator() + processUid; //DefaultRootDirectory;
        }
    }
    
    QString installPath("");
    installPath = QDir::toNativeSeparators(result);
    
    if (installPath.startsWith("Z"))
        installPath.replace(0, 1, "C");
    
    QString privatePath = installPath[0]+":"+QDir::separator()+"private";
    if ( !createDir(privatePath) ) 
    {
        return QString();
    }
    
    if (! createDir(installPath)) {
        return QString();
    }
    installPath = installPath + QDir::separator() + WidgetFolder;
    
    if (! createDir(installPath)) {
        return QString();
    }
    return installPath;   
}
Beispiel #4
0
bool Path::isAbsolute() const
{
	if(driveLetter() != 0)
		return true;
	return _path.compare(0, 1, "/") == 0;
}