static TDriveUnit writableExeDrive() { TDriveUnit drive = exeDrive(); if(drive.operator TInt() == EDriveZ) return TDriveUnit(EDriveC); return drive; }
static TPtrC writableDataRoot() { TDriveUnit drive = exeDrive(); #ifdef Q_OS_SYMBIAN switch(drive.operator TInt()){ case EDriveC: return PathInfo::PhoneMemoryRootPath(); break; case EDriveE: return PathInfo::MemoryCardRootPath(); break; case EDriveZ: // It is not possible to write on ROM drive -> // return phone mem root path instead return PathInfo::PhoneMemoryRootPath(); break; default: return PathInfo::PhoneMemoryRootPath(); break; } #else #warning No fallback implementation of writableDataRoot() return 0; #endif }
static TPtrC writableDataRoot() { TDriveUnit drive = exeDrive(); switch (drive.operator TInt()){ case EDriveC: return PathInfo::PhoneMemoryRootPath(); break; case EDriveE: return PathInfo::MemoryCardRootPath(); break; case EDriveZ: // It is not possible to write on ROM drive -> // return phone mem root path instead return PathInfo::PhoneMemoryRootPath(); break; default: return PathInfo::PhoneMemoryRootPath(); break; } }
QString QDesktopServices::storageLocation(StandardLocation type) { TFileName path; switch (type) { case DesktopLocation: qWarning("No desktop concept in Symbian OS"); // But lets still use some feasible default path.Append(writableDataRoot()); break; case DocumentsLocation: path.Append(writableDataRoot()); break; case FontsLocation: path.Append(KFontsDir); break; case ApplicationsLocation: path.Append(exeDrive().Name()); path.Append(KSysBin); break; case MusicLocation: path.Append(writableDataRoot()); #ifdef Q_OS_SYMBIAN path.Append(PathInfo::SoundsPath()); #endif break; case MoviesLocation: path.Append(writableDataRoot()); #ifdef Q_OS_SYMBIAN path.Append(PathInfo::VideosPath()); #endif break; case PicturesLocation: path.Append(writableDataRoot()); #ifdef Q_OS_SYMBIAN path.Append(PathInfo::ImagesPath()); #endif break; case TempLocation: return QDir::tempPath(); break; case HomeLocation: path.Append(writableDataRoot()); //return QDir::homePath(); break; break; case DataLocation: qt_s60GetRFs().PrivatePath(path); path.Insert(0, writableExeDrive().Name()); break; case CacheLocation: qt_s60GetRFs().PrivatePath(path); path.Insert(0, writableExeDrive().Name()); path.Append(KCacheSubDir); break; default: // Lets use feasible default path.Append(writableDataRoot()); break; } // Convert to cross-platform format and clean the path QString nativePath = QString::fromUtf16(path.Ptr(), path.Length()); QString qtPath = QDir::fromNativeSeparators(nativePath); qtPath = QDir::cleanPath(qtPath); // Note: The storage location returned can be a directory that does not exist; // i.e., it may need to be created by the system or the user. return qtPath; }