Gjsify LogoGjsify Logo

Index

Functions

  • dirfd_iterator_init_at(dfd: number, path: string, follow: boolean, dfd_iter: DirFdIterator): boolean
  • dirfd_iterator_init_take_fd(dfd: number, dfd_iter: DirFdIterator): boolean
  • Read all extended attributes from fd in a canonical sorted order, and set out_xattrs with the result.

    If the filesystem does not support extended attributes, out_xattrs will have 0 elements, and this function will return successfully.

    Parameters

    • fd: number

      a file descriptor

    • cancellable: Gio.Cancellable

      Cancellable

    Returns [boolean, GLib.Variant]

  • For each attribute in xattrs, set its value on the file or directory referred to by fd. This function does not remove any attributes not in xattrs.

    Parameters

    Returns boolean

  • Like g_file_create(), except this function allows specifying the access mode. This allows atomically creating private files.

    Parameters

    • file: Gio.File

      Path to non-existent file

    • mode: number

      Unix access permissions

    • cancellable: Gio.Cancellable

      a #GCancellable

    Returns [boolean, Gio.OutputStream]

  • Like g_file_make_directory(), except does not throw an error if the directory already exists.

    Parameters

    • dir: Gio.File

      Path to create as directory

    • with_parents: boolean

      Also create parent directories

    • cancellable: Gio.Cancellable

      a #GCancellable

    Returns boolean

  • Wraps UNIX mkdir() function with support for cancellable, and uses error instead of errno.

    Parameters

    • dir: Gio.File

      Path to create as directory

    • mode: number

      Create directory with these permissions

    • cancellable: Gio.Cancellable

      a #GCancellable

    Returns boolean

  • This is a version of g_file_enumerator_next_file() that's easier to use correctly from C programs. With g_file_enumerator_next_file(), the gboolean return value signifies "end of iteration or error", which requires allocation of a temporary #GError.

    In contrast, with this function, a %FALSE return from gs_file_enumerator_iterate() always means "error". End of iteration is signaled by out_info being %NULL.

    Another crucial difference is that the references for out_info and out_child are owned by direnum (they are cached as hidden properties). You must not unref them in your own code. This makes memory management significantly easier for C code in combination with loops.

    Finally, this function optionally allows retrieving a #GFile as well.

    The code pattern for correctly using gs_file_enumerator_iterate() from C is:

    |[ direnum = g_file_enumerate_children (file, ...); while (TRUE) { GFileInfo *info; if (!gs_file_enumerator_iterate (direnum, &info, NULL, cancellable, error)) goto out; if (!info) break; ... do stuff with "info"; do not unref it! ... }

    out: g_object_unref (direnum); // Note: frees the last info


    @param direnum an open #GFileEnumerator
    @param cancellable a #GCancellable

    Parameters

    Returns [boolean, Gio.FileInfo, Gio.File]

  • Read all extended attributes of f in a canonical sorted order, and set out_xattrs with the result.

    If the filesystem does not support extended attributes, out_xattrs will have 0 elements, and this function will return successfully.

    Parameters

    Returns [boolean, GLib.Variant]

  • file_get_basename_cached(file: Gio.File): string
  • file_get_path_cached(file: Gio.File): string
  • Like gs_file_get_relative_path(), but does not mandate that the two files have any parent in common. This function will instead insert "../" where appropriate.

    Parameters

    Returns string

  • First tries to use the UNIX link() call, but if the files are on separate devices, fall back to copying via g_file_copy().

    The given flags have different semantics than those documented when hardlinking is used. Specifically, both #G_FILE_COPY_TARGET_DEFAULT_PERMS and #G_FILE_COPY_BACKUP are not supported. #G_FILE_COPY_NOFOLLOW_SYMLINKS treated as if it was always given - if you want to follow symbolic links, you will need to resolve them manually.

    Beware - do not use this function if src may be modified, and it's undesirable for the changes to also be reflected in dest. The best use of this function is in the case where src and dest are read-only, or where src is a temporary file, and you want to put it in the final place.

    Parameters

    Returns boolean

  • On success, sets out_fd to a file descriptor for the directory that can be used with UNIX functions such as openat().

    Parameters

    Returns [boolean, number]

  • file_open_dir_fd_at(parent_dfd: number, name: string, cancellable: Gio.Cancellable): [boolean, number]
  • On success, sets out_fd to a file descriptor for the directory that can be used with UNIX functions such as openat().

    Parameters

    • parent_dfd: number

      Parent directory file descriptor

    • name: string

      Directory name

    • cancellable: Gio.Cancellable

      Cancellable

    Returns [boolean, number]

  • Like g_file_open_tmp(), except the file will be created in the provided tmpdir, and allows specification of the Unix mode, which means private files may be created. Return values will be stored in out_file, and optionally out_stream.

    Parameters

    • tmpdir: Gio.File

      Directory to place temporary file

    • mode: number

      Default mode (will be affected by umask)

    • cancellable: Gio.Cancellable

    Returns [boolean, Gio.File, Gio.OutputStream]

  • Like g_file_open_tmp(), except the file will be created in the provided tmpdir, and allows specification of the Unix mode, which means private files may be created. Return values will be stored in out_name, and optionally out_stream.

    Parameters

    • tmpdir_fd: number

      Directory to place temporary file

    • mode: number

      Default mode (will be affected by umask)

    • cancellable: Gio.Cancellable

    Returns [boolean, string, Gio.OutputStream]

  • file_openat_noatime(dfd: number, name: string, cancellable: Gio.Cancellable): [boolean, number]
  • Wrapper for openat() using %O_RDONLY with %O_NOATIME if available.

    Parameters

    • dfd: number

      File descriptor for directory

    • name: string

      Pathname, relative to dfd

    • cancellable: Gio.Cancellable

      Cancellable

    Returns [boolean, number]

  • Return a #GFile that contains the same path with symlinks followed. That is, it's a #GFile whose path is the result of calling realpath() on file.

    Parameters

    Returns Gio.File | null

  • For each attribute in xattrs, set its value on the file or directory referred to by file. This function does not remove any attributes not in xattrs.

    Parameters

    Returns boolean

  • Like g_file_delete(), except this function does not follow Unix symbolic links, and will delete a symbolic link even if it's pointing to a nonexistent file. In other words, this function merely wraps the raw Unix function unlink().

    Parameters

    Returns boolean

  • fileutil_gen_tmp_name(prefix: string, suffix: string): string
  • Generate a name suitable for use as a temporary file. This function does no I/O; it is not guaranteed that a file with that name does not exist.

    Parameters

    • prefix: string

      String prepended to the result

    • suffix: string

      String suffixed to the result

    Returns string

  • log_structured(message: string, keys: string[]): void
  • log_structured_print(message: string, keys: string[]): void
  • Like gs_log_structured(), but also print to standard output (if it is not already connected to the system log).

    Parameters

    • message: string

      A message to log

    • keys: string[]

      Optional structured data

    Returns void

  • opendirat(dfd: number, path: string, follow: boolean, out_fd: number): boolean
  • Use openat() to open a directory, using a standard set of flags.

    Parameters

    • dfd: number

      File descriptor for origin directory

    • path: string

      Pathname, relative to dfd

    • follow: boolean

      Whether or not to follow symbolic links

    • out_fd: number

    Returns boolean

  • opendirat_with_errno(dfd: number, path: string, follow: boolean): number
  • Use openat() to open a directory, using a standard set of flags. This function sets errno.

    Parameters

    • dfd: number

      File descriptor for origin directory

    • path: string

      Pathname, relative to dfd

    • follow: boolean

      Whether or not to follow symbolic links

    Returns number

  • set_error_from_errno(error: GLib.Error, saved_errno: number): void
  • Set error to an error with domain %G_IO_ERROR, and code based on the value of saved_errno. The error message is set using a literal return from g_strerror().

    Parameters

    • error: GLib.Error

      Error

    • saved_errno: number

      errno value

    Returns void

  • Recursively copy path src (which must be a directory) to the target dest. If possible, hardlinks are used; if a hardlink is not possible, a regular copy is created. Any existing files are overwritten.

    Parameters

    Returns boolean

  • shutil_rm_rf_at(dfd: number, path: string, cancellable: Gio.Cancellable): boolean
  • Recursively delete the filename referenced by the combination of the directory fddfd and path; it may be a file or directory. No error is thrown if path does not exist.

    Parameters

    • dfd: number

      A directory file descriptor, or -1 for current

    • path: string

      Path

    • cancellable: Gio.Cancellable

      Cancellable

    Returns boolean

  • stdout_is_journal(): boolean
  • Use this function when you want your code to behave differently depeneding on whether your program was started as a systemd unit, or e.g. interactively at a terminal.

    Returns boolean

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method