qtmobility/tests/auto/qsfwtestutil.cpp
changeset 15 1f895d8a5b2b
parent 11 06b8e2af4411
equal deleted inserted replaced
14:6fbed849b4f4 15:1f895d8a5b2b
    87     return tempSettingsPath("__system__/");
    87     return tempSettingsPath("__system__/");
    88 }
    88 }
    89 
    89 
    90 QString QSfwTestUtil::tempSettingsPath(const char *path)
    90 QString QSfwTestUtil::tempSettingsPath(const char *path)
    91 {
    91 {
    92 #if defined(Q_OS_SYMBIAN) && defined(__WINS__)
       
    93     // On emulator, use hardcoded path instead of private directories to
       
    94     // enable a shared database.
       
    95     Q_UNUSED(path);
       
    96     return QDir::toNativeSeparators("C:/Data/temp/QtServiceFW");
       
    97 #else
       
    98     // Temporary path for files that are specified explictly in the constructor.
    92     // Temporary path for files that are specified explictly in the constructor.
    99     //QString tempPath = QDir::tempPath();
    93     //QString tempPath = QDir::tempPath();
   100     QString tempPath = QCoreApplication::applicationDirPath();
    94     QString tempPath = QCoreApplication::applicationDirPath();
   101     if (tempPath.endsWith("/"))
    95     if (tempPath.endsWith("/"))
   102         tempPath.truncate(tempPath.size() - 1);
    96         tempPath.truncate(tempPath.size() - 1);
   103     return QDir::toNativeSeparators(tempPath + "/QtServiceFramework_tests/" + QLatin1String(path));
    97     return QDir::toNativeSeparators(tempPath + "/QtServiceFramework_tests/" + QLatin1String(path));
   104 #endif
       
   105 }
    98 }
   106 
    99 
   107 void QSfwTestUtil::removeDirectory(const QString &path)
   100 void QSfwTestUtil::removeDirectory(const QString &path)
   108 {
   101 {
   109     QDir dir(path);
   102     QDir dir(path);
   120         }
   113         }
   121     }
   114     }
   122     dir.rmpath(path);
   115     dir.rmpath(path);
   123 }
   116 }
   124 
   117 
   125 #if defined(Q_OS_SYMBIAN) && !defined(__WINS__)
   118 #if defined(Q_OS_SYMBIAN)
   126 #include <e32base.h>
   119 #include <e32base.h>
   127 #include <f32file.h>
   120 void QSfwTestUtil::removeDatabases_symbian()
   128 void QSfwTestUtil::removeDatabases()
       
   129 {
   121 {
       
   122 #if defined(__WINS__) && !defined(SYMBIAN_EMULATOR_SUPPORTS_PERPROCESS_WSD)
       
   123     QDir dir("C:/Data/temp/QtServiceFW");
       
   124 #else
   130     TFindServer findServer(_L("!qsfwdatabasemanagerserver"));
   125     TFindServer findServer(_L("!qsfwdatabasemanagerserver"));
   131     TFullName name;
   126     TFullName name;
   132     if (findServer.Next(name) == KErrNone)
   127     if (findServer.Next(name) == KErrNone)
   133     {
   128     {
   134         RProcess dbServer;
   129         RProcess dbServer;
   137             dbServer.Kill(KErrNone);
   132             dbServer.Kill(KErrNone);
   138             dbServer.Close();    
   133             dbServer.Close();    
   139         }
   134         }
   140     }    
   135     }    
   141 
   136 
   142     RFs fs;
   137     QDir dir("c:/private/2002AC7F");
   143     fs.Connect();
   138 #endif
   144     CleanupClosePushL(fs);
   139 
   145     CFileMan* fileMan=CFileMan::NewL(fs);
   140     QString qtVersion(qVersion());
   146     CleanupStack::PushL(fileMan);
   141     qtVersion = qtVersion.left(qtVersion.size() - 2); //strip off patch version
   147     fileMan->Delete(_L("c:\\private\\2002AC7F\\QtServiceFramework_4.6_system.db")); //Server's fixed UID3
   142     QString dbIdentifier = "_system";
   148     CleanupStack::PopAndDestroy(2, &fs);    
   143     QString dbName = QString("QtServiceFramework_") + qtVersion + dbIdentifier + QLatin1String(".db");
       
   144     QFile::remove(QDir::toNativeSeparators(dir.path() + QDir::separator() + dbName));
   149 }
   145 }
   150 #endif
   146 #endif