/** * Rename the file database. * * @param oldName - old name of the file database * @param name - new name to give the file database. * @return true if the the file database is renamed. */ public boolean renameFileDatabase(String currentName, String newName) { boolean renamed = false; DefaultFileDatabase fd = getFileDatabase(currentName); if (fileDatabases.contains(fd)) { // make sure the new folder name does not exist File f = new File(fd.getPath() + newName.trim()); if (!f.exists()) { if (!FileSystemManager.renameFile( new File(fd.getFullPath()), new File(fd.getPath() + newName))) { throw new IllegalStateException("Could not rename file"); } fileDatabases.remove(fd); } fd.setName(newName); fileDatabases.add(fd); renamed = true; } return renamed; }