/*! * This is a private utility function which creates a new collection using * the given collection details. We resolve the type of the collection, and * return an appropriate subclass of CSAbstractCollection. * * \param n The name of the collection. * \param p The path of the collection. */ CSAbstractCollection *CSCollectionTypeResolver::createCollection( const QString &n, const QString &p) const { CSAbstractCollection *c = NULL; /* * Check if it's an iPod collection - this implies * (path)/iPod_Control/iTunes/iTunesDB exists. */ QFileInfo itdb(QDir::cleanPath(p).append( QString("/iPod_Control/iTunes/iTunesDB") .replace('/', QDir::separator()))); if(itdb.exists()) c = new CSIPodCollection(n); /* * If we didn't recognize it as anything special, treat it as simply * a directory collection. */ if(c == NULL) c = new CSDirCollection(n); return c; }
/////////////////////////////////////// // on qualified name, select direct DB // DbIntlog *DbIntlog::FixPathName(Term *t) const { DbIntlog *db = (DbIntlog*)this; Term r = *t; while (db && r.is_expr(Operator::PATHNAME) && r.getarg(0).type(f_ATOM)) { kstring dbid = r.getarg(0).kstr(); if (!strcmp(dbid, "..")) db = db->m_father; else { DbInherIter itdb(db); while ((db = itdb.next()) != 0) if (db->GetId() == dbid) break; } if (db) r = r.getarg(1); } *t = r; return db; }