Gio.File.prototype.has_prefix

function has_prefix(prefix: Gio.File): Boolean {
    // Gjs wrapper for g_file_has_prefix()
}
  

Checks whether file has the prefix specified by prefix.

In other words, if the names of initial elements of file's pathname match prefix. Only full pathname elements are matched, so a path like /foo is not considered a prefix of /foobar, only of /foo/bar.

This call does no I/O, as it works purely on names. As such it can sometimes return false even if file is inside a prefix (from a filesystem point of view), because the prefix of file is an alias of prefix.

prefix

input Gio.File

Returns

true if the @files's parent, grandparent, etc is prefix, false otherwise.