private boolean checkCatalogExistence(File catalogParentFolder,boolean checkCatalogFolderOnly){
  if (!catalogParentFolder.exists()) {
    if (logger.isTraceEnabled())     logger.trace("checkCatalogExistence: true (parent does not exist");
    return true;
  }
switch (currentProfile.getDeviceMode()) {
case Nook:
    File trookFile=new File(catalogParentFolder,Constants.TROOK_SEARCH_DATABASE_FILENAME);
  if (!trookFile.exists()) {
    if (logger.isTraceEnabled())     logger.trace("checkCatalogExistence: false (trook database file does not exist");
    return false;
  }
break;
default :
File catalogFolder;
if (currentProfile.getOnlyCatalogAtTarget()) {
catalogFolder=catalogParentFolder;
}
 else {
catalogFolder=new File(catalogParentFolder,CatalogManager.getCatalogFolderName());
}
if ((false == catalogFolder.exists()) && (true == checkCatalogFolderOnly)) {
if (logger.isTraceEnabled()) logger.trace("checkCatalogExistence: true (catalog folder does not exist");
return true;
}
if (logger.isTraceEnabled()) logger.trace("checkCatalogExistence: Check for catalog at " + catalogFolder.getPath());
if (!catalogFolder.exists()) {
if (logger.isTraceEnabled()) logger.trace("checkCatalogExistence: false (catalog folder does not exist)");
return false;
}
File desktopFile=new File(catalogFolder,"desktop.css");
if (!desktopFile.exists()) {
if (logger.isTraceEnabled()) logger.trace("checkCatalogExistence: false (desktop.css file does not exist)");
return false;
}
File mobileFile=new File(catalogFolder,"mobile.css");
if (!mobileFile.exists()) {
if (logger.isTraceEnabled()) logger.trace("checkCatalogExistence: false (desktop.css file does not exist)");
return false;
}
break;
}
if (logger.isTraceEnabled()) logger.trace("checkCatalogExistence: true");
return true;
}

private boolean checkCatalogExistence ( File catalogParentFolder , boolean checkCatalogFolderOnly ) { if ( ! catalogParentFolder . exists ( ) ) { if ( logger . isTraceEnabled ( ) ) logger . trace ( "checkCatalogExistence: true (parent does not exist" ) ; return true ; } switch ( currentProfile . getDeviceMode ( ) ) { case Nook : File trookFile = new File ( catalogParentFolder , Constants . TROOK_SEARCH_DATABASE_FILENAME ) ; if ( ! trookFile . exists ( ) ) { if ( logger . isTraceEnabled ( ) ) logger . trace ( "checkCatalogExistence: false (trook database file does not exist" ) ; return false ; } break ; default : File catalogFolder ; if ( currentProfile . getOnlyCatalogAtTarget ( ) ) { catalogFolder = catalogParentFolder ; } else { catalogFolder = new File ( catalogParentFolder , CatalogManager . getCatalogFolderName ( ) ) ; } if ( ( false == catalogFolder . exists ( ) ) && ( true == checkCatalogFolderOnly ) ) { if ( logger . isTraceEnabled ( ) ) logger . trace ( "checkCatalogExistence: true (catalog folder does not exist" ) ; return true ; } if ( logger . isTraceEnabled ( ) ) logger . trace ( "checkCatalogExistence: Check for catalog at " + catalogFolder . getPath ( ) ) ; if ( ! catalogFolder . exists ( ) ) { if ( logger . isTraceEnabled ( ) ) logger . trace ( "checkCatalogExistence: false (catalog folder does not exist)" ) ; return false ; } File desktopFile = new File ( catalogFolder , "desktop.css" ) ; if ( ! desktopFile . exists ( ) ) { if ( logger . isTraceEnabled ( ) ) logger . trace ( "checkCatalogExistence: false (desktop.css file does not exist)" ) ; return false ; } File mobileFile = new File ( catalogFolder , "mobile.css" ) ; if ( ! mobileFile . exists ( ) ) { if ( logger . isTraceEnabled ( ) ) logger . trace ( "checkCatalogExistence: false (desktop.css file does not exist)" ) ; return false ; } break ; } if ( logger . isTraceEnabled ( ) ) logger . trace ( "checkCatalogExistence: true" ) ; return true ; }
check to see if there appears to already be an existing calibre2opds catalog at the specified location ( by checking for specific files ) . note that a false is always definitive , while a true could return a false ( although unlikely ) positive .
