Function: file-name-case-insensitive-p

file-name-case-insensitive-p is a function defined in fileio.c.

Signature

(file-name-case-insensitive-p FILENAME)

Documentation

Return t if file FILENAME is on a case-insensitive filesystem.

Return nil if FILENAME does not exist or is not on a case-insensitive filesystem, or if there was trouble determining whether the filesystem is case-insensitive.

Probably introduced at or before Emacs version 26.1.

Source Code

// Defined in /usr/src/emacs/src/fileio.c
{
  Lisp_Object handler;

  CHECK_STRING (filename);
  filename = Fexpand_file_name (filename, Qnil);

  /* If the file name has special constructs in it,
     call the corresponding file name handler.  */
  handler = Ffind_file_name_handler (filename, Qfile_name_case_insensitive_p);
  if (!NILP (handler))
    return call2 (handler, Qfile_name_case_insensitive_p, filename);

  /* If the file doesn't exist or there is trouble checking its
     filesystem, move up the filesystem tree until we reach an
     existing, trouble-free directory or the root.  */
  while (true)
    {
      int err = file_name_case_insensitive_err (filename);
      if (err <= 0)
	return err < 0 ? Qt : Qnil;
      Lisp_Object parent = file_name_directory (filename);
      /* Avoid infinite loop if the root has trouble
	 (impossible?).  */
      if (!NILP (Fstring_equal (parent, filename)))
	return Qnil;
      filename = parent;
    }
}