About all my projects
Gnome::Gio::T-file

Gnome::Gio::T-file

Class initialization

new

Initialization of a type class is simple and only needed when the standalone functions are used.

method new ( )

Standalone Functions

file-new-build-filenamev

Constructs a Gnome::Gio::R-File from a vector of elements using the correct separator for filenames.

Using this function is equivalent to calling g_build_filenamev(), followed by .new-for-path() on the result.

method file-new-build-filenamev ( Array[Str] $args --> N-Object )
  • $args; strings array containing the path elements..

Return value; a new Gnome::Gio::R-File.

file-new-for-commandline-arg

Creates a Gnome::Gio::R-File with the given argument from the command line. The value of $arg can be either a URI, an absolute path or a relative path resolved relative to the current working directory. This operation never fails, but the returned object might not support any I/O operation if $arg points to a malformed path.

Note that on Windows, this function expects its argument to be in UTF-8 -- not the system code page. This means that you should not use this function with string from argv as it is passed to main(). g_win32_get_command_line() will return a UTF-8 version of the commandline. Gnome::Gio::Application also uses UTF-8 but g_application_command_line_create_file_for_arg() may be more useful for you there. It is also always possible to use this function with GOptionContext arguments of type G_OPTION_ARG_FILENAME.

method file-new-for-commandline-arg ( Str $arg --> N-Object )
  • $arg; a command line string.

Return value; a new Gnome::Gio::R-File. Free the returned object with g_object_unref()..

file-new-for-commandline-arg-and-cwd

Creates a Gnome::Gio::R-File with the given argument from the command line.

This function is similar to .new-for-commandline-arg() except that it allows for passing the current working directory as an argument instead of using the current working directory of the process.

This is useful if the commandline argument was given in a context other than the invocation of the current process.

See also g_application_command_line_create_file_for_arg().

method file-new-for-commandline-arg-and-cwd ( Str $arg, Str $cwd --> N-Object )
  • $arg; a command line string.

  • $cwd; the current working directory of the commandline.

Return value; a new Gnome::Gio::R-File.

file-new-for-path

Constructs a Gnome::Gio::R-File for a given path. This operation never fails, but the returned object might not support any I/O operation if $path is malformed.

method file-new-for-path ( Str $path --> N-Object )
  • $path; a string containing a relative or absolute path. The string must be encoded in the glib filename encoding..

Return value; a new Gnome::Gio::R-File for the given $path. Free the returned object with g_object_unref()..

file-new-for-uri

Constructs a Gnome::Gio::R-File for a given URI. This operation never fails, but the returned object might not support any I/O operation if $uri is malformed or if the uri type is not supported.

method file-new-for-uri ( Str $uri --> N-Object )
  • $uri; a UTF-8 string containing a URI.

Return value; a new Gnome::Gio::R-File for the given $uri. Free the returned object with g_object_unref()..

file-new-tmp

Opens a file in the preferred directory for temporary files (as returned by g_get_tmp_dir()) and returns a Gnome::Gio::R-File and Gnome::Gio::FileIOStream pointing to it. $tmpl should be a string in the GLib file name encoding containing a sequence of six 'X' characters, and containing no directory components. If it is undefined, a default template is used.

Unlike the other Gnome::Gio::R-File constructors, this will return undefined if a temporary file could not be created.

method file-new-tmp ( Str $tmpl, N-Object() $iostream, CArray[N-Error] $err --> N-Object )
  • $tmpl; Template for the file name, as in .open-tmp(), or undefined for a default template.

  • $iostream; (transfer ownership: full) on return, a Gnome::Gio::FileIOStream for the created file.

  • $err; Error object. When defined, an error can be returned when there is one. Use Pointer when you want to ignore the error. .

Return value; a new Gnome::Gio::R-File. Free the returned object with g_object_unref()..

file-new-tmp-async

Asynchronously opens a file in the preferred directory for temporary files (as returned by g_get_tmp_dir()) as .new-tmp(). $tmpl should be a string in the GLib file name encoding containing a sequence of six 'X' characters, and containing no directory components. If it is undefined, a default template is used.

method file-new-tmp-async ( Str $tmpl, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
  • $tmpl; Template for the file name, as in .open-tmp(), or undefined for a default template.

  • $io-priority; the I/O priority of the request.

  • $cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.

  • GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is done. The function must be specified with the following signature; :( N-Object $source-object, N-Object $res, gpointer $data ).

  • $user-data; data to pass to $callback.

file-new-tmp-dir-async

Asynchronously creates a directory in the preferred directory for temporary files (as returned by g_get_tmp_dir()) as g_dir_make_tmp(). $tmpl should be a string in the GLib file name encoding containing a sequence of six 'X' characters, and containing no directory components. If it is undefined, a default template is used.

method file-new-tmp-dir-async ( Str $tmpl, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
  • $tmpl; Template for the file name, as in g_dir_make_tmp(), or undefined for a default template.

  • $io-priority; the I/O priority of the request.

  • $cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.

  • GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is done. The function must be specified with the following signature; :( N-Object $source-object, N-Object $res, gpointer $data ).

  • $user-data; data to pass to $callback.

file-new-tmp-dir-finish

Finishes a temporary directory creation started by .new-tmp-dir-async().

method file-new-tmp-dir-finish ( N-Object() $result, CArray[N-Error] $err --> N-Object )
  • $result; a Gnome::Gio::R-AsyncResult.

  • $err; Error object. When defined, an error can be returned when there is one. Use Pointer when you want to ignore the error. .

Return value; a new Gnome::Gio::R-File. Free the returned object with g_object_unref()..

file-new-tmp-finish

Finishes a temporary file creation started by .new-tmp-async().

method file-new-tmp-finish ( N-Object() $result, N-Object() $iostream, CArray[N-Error] $err --> N-Object )
  • $result; a Gnome::Gio::R-AsyncResult.

  • $iostream; (transfer ownership: full) on return, a Gnome::Gio::FileIOStream for the created file.

  • $err; Error object. When defined, an error can be returned when there is one. Use Pointer when you want to ignore the error. .

Return value; a new Gnome::Gio::R-File. Free the returned object with g_object_unref()..

file-parse-name

Constructs a Gnome::Gio::R-File with the given $parse-name (i.e. something given by .get-parse-name()). This operation never fails, but the returned object might not support any I/O operation if the $parse-name cannot be parsed.

method file-parse-name ( Str $parse-name --> N-Object )
  • $parse-name; a file name or path to be parsed.

Return value; a new Gnome::Gio::R-File..