Пример #1
0
void FLDiskCache::init(FLApplication *app)
{
  QTextCodec *codec = QTextCodec::codecForLocale();
  QString localEncode(codec ? codec->mimeName() : "");
  if (!app) {
    aqSetAndCreateDirPath(AQ_USRHOME + "/.eneboocache");
    if (!localEncode.isEmpty())
      aqSetAndCreateDirPath(AQ_DISKCACHE_DIRPATH + '/' + localEncode);
  } else {
    aqSetAndCreateDirPath(
      AQ_USRHOME + "/.eneboocache/" +
      app->db()->database()
    );
    if (!localEncode.isEmpty())
      aqSetAndCreateDirPath(AQ_DISKCACHE_DIRPATH + '/' + localEncode);
  }
}
Пример #2
0
void FLDiskCache::init(FLApplication *app)
{
  QTextCodec *codec = QTextCodec::codecForLocale();
  QString localEncode(codec ? codec->mimeName() : "");
  if (!app) {
    aqSetAndCreateDirPath(AQ_USRHOME + "/.eneboocache");
    if (!localEncode.isEmpty())
      aqSetAndCreateDirPath(AQ_DISKCACHE_DIRPATH + '/' + localEncode);
  } else {
    if ( app->db()->driverName() != "FLsqlite")
    aqSetAndCreateDirPath(
      AQ_USRHOME + "/.eneboocache/" +
      app->db()->database()
    );
    else
    {
    // --> Aulla : Reconstruimos un nombre válido para crear el directorio de la caché cuando usamos el driver SQLite
    QString DBName = app->db()->database();
    DBName.replace(AQ_DISKCACHE_DIRPATH,""); //Limpiamos el path
    DBName.replace(".s3db","");//Limpiamos la extensión
    aqSetAndCreateDirPath(
      AQ_USRHOME + "/.eneboocache/" +
      DBName
    );
    // <-- Aulla:
    }
    
    
    if (!localEncode.isEmpty())
      aqSetAndCreateDirPath(AQ_DISKCACHE_DIRPATH + '/' + localEncode);

    QDir d(AQ_DISKCACHE_DIRPATH);
    if (d.exists()) {
      QStringList lst = d.entryList("*.*", QDir::Files);
      for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it) {
        QString item(*it);
        if (!item.endsWith(".qm"))
          d.remove(AQ_DISKCACHE_DIRPATH + '/' + item);
      }
    }
  }
}
Пример #3
0
void FLDiskCache::clear()
{
  QDir d(AQ_DISKCACHE_DIRPATH);
  if (d.exists()) {
    QStringList lst = d.entryList("*; *.*");
    for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it)
      d.remove(AQ_DISKCACHE_DIRPATH + '/' + (*it));
  }
#ifndef QSDEBUGGER
  QTextCodec *codec = QTextCodec::codecForLocale();
  QString localEncode(codec ? codec->mimeName() : "");
  QString path(AQ_USRHOME + "/.eneboocache/" + localEncode);
  QDir d2(path);
  if (d2.exists()) {
    QStringList lst = d2.entryList("sys*");
    for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it)
      d2.remove(path + '/' + (*it));
  }
#endif
}