Checks whether a database of the given name exists in the given directory or not.

@param name      the database's name
@param directory the path where the database is located.
@return true if exists, false otherwise.
492641
public static boolean exists(@NonNull String name, @NonNull File directory) {
        if (name == null) { throw new IllegalArgumentException("name cannot be null."); }
        if (directory == null) { throw new IllegalArgumentException("directory cannot be null."); }
        return getDatabasePath(directory, name).exists();
    }
1047299
public static boolean checkIfFileExists(String filePath) {
        File file = new File(filePath);// getSDCardPath(), filePath);
        return (file.exists() ? true : false);
    }
512572
public boolean isOwner(String name) {
        boolean result = false;
        if (aclList.containsKey(name)) {
            result = aclList.get(name).isOwner();
        }
        return result;
    }
1255129
public boolean exists(Path filename) throws IOException {
    try {
      return getMfs().listFiles(filename, true).hasNext();
    } catch (FileNotFoundException e) {
      return false;
    }
  }
334028
private void checkDirectory(String d) {
    if (!d.startsWith(Path.SEPARATOR)) {
      throw new IllegalArgumentException("Bad directory:" + d);
    }
    if (d.endsWith(Path.SEPARATOR)) {
      throw new IllegalArgumentException("Bad directory:" + d);
    }
  }
1375051
public static boolean isInDirectory(File file, File directory) {
        try {
            return FilenameUtils.directoryContains(directory.getCanonicalPath(), file.getCanonicalPath());
        } catch (IOException e) { //NOSONAR
            return false;
        }
    }
661155
public boolean exist(String name, boolean bankAccount) {
        String newName = name;
        if (!Common.getInstance().getMainConfig().getBoolean("System.Case-sentitive")) {
            newName = name.toLowerCase();
        }
        boolean result;
        if (bankAccount) {
            result = bankList.containsKey(newName);
            if (!result) {
                result = Common.getInstance().getStorageHandler().getStorageEngine().accountExist(newName, bankAccount);
            }
        } else {
            result = accountList.containsKey(newName);
            if (!result) {
                result = Common.getInstance().getStorageHandler().getStorageEngine().accountExist(newName, bankAccount);
            }
        }
        return result;
    }
82713
public static function isExistByNameCategoryId( $name, $categoryId ) {

		$option = self::findByNameCategoryId( $name, $categoryId );

		return isset( $option );
	}
1161963
public static void checkValidDir(final File dir) {
        checkNotNull("dir", dir);
        if (!dir.exists()) {
            throw new IllegalArgumentException("The directory '" + dir + "' does not exist!");
        }
        if (!dir.isDirectory()) {
            throw new IllegalArgumentException("The name '" + dir + "' is not a directory!");
        }
    }
170924
public boolean exist(String path) {
		final String fileName = FileUtil.getName(path);
		final String dir = StrUtil.removeSuffix(path, fileName);
		final List<String> names = ls(dir);
		return containsIgnoreCase(names, fileName);
	}
33689
private static boolean checkThemeFile(final String name) {
		return !(Util.empty(name) // name must exist
				|| name.contains("..") // prevent directory traversal
				|| name.charAt(0) == '/' // all theme references should be relative
				|| name.indexOf(':') != -1 // forbid use of protocols such as jar:, http: etc.
				);
	}
506714
public function hasDatabase($name)
    {
        foreach ($this->databases as $database) {
            if ($database->getName() === $name) {
                return true;
            }
        }

        return false;
    }
313411
protected function prepareDirectory($directory, $name)
    {
        if (!is_dir($directory)) {
            if (!@mkdir($directory, 0777, true) && !is_dir($directory)) {
                throw new RuntimeException(
                    sprintf(
                        "Unable to create the %s directory (%s)\n",
                        $name,
                        $directory
                    )
                );
            }
        } elseif (!is_writable($directory)) {
            throw new RuntimeException(
                sprintf(
                    "Unable to write in the %s directory (%s)\n",
                    $name,
                    $directory
                )
            );
        }
    }
702136
public static boolean deleteDirectory(final File dir) {
		boolean success = true;
		if (dir != null && dir.exists()) {
			try {
				if (dir.isDirectory()) {
					for (final File file : dir.listFiles()) {
						if(file == null) {
							return false;
						}
						if (!deleteDirectory(file)) {
							success = false;
							return success;
						}
					}
				}
				if (!dir.delete()) {
					success = false;
					return success;
				}
				return success;
			} catch (Exception e) {
				// Failed to delete files or directory
			}
		}
		return false;
	}
1101590
public boolean is_empty(String name) {
        DbDatum datum = getDatum(name);
        return datum==null || datum.is_empty();
    }
71444
public boolean exists(long featureId, String database, String table) {
        boolean exists = false;
        Map<String, Map<Long, FeatureShape>> tables = databases.get(database);
        if (tables != null) {

            Map<Long, FeatureShape> featureIds = tables.get(table);
            if (featureIds != null) {
                FeatureShape shapes = featureIds.get(featureId);
                exists = shapes != null && shapes.hasShapes();
            }
        }
        return exists;
    }
913916
@InterfaceAudience.Private
    private String pathForDatabaseNamed(String name) {
        if ((name == null) || (name.length() == 0) || Pattern.matches(LEGAL_CHARACTERS, name))
            return null;
        // NOTE: CouchDB allows forward slash as part of database name.
        //       However, ':' is illegal character on Windows platform.
        //       For Windows, substitute with period '.'
        name = isWindows() ? name.replace('/', '.') : name.replace('/', ':');
        String result = directoryFile.getPath() + File.separator + name + Manager.kDBExtension;
        return result;
    }