### ----------------------------------------------------
### -- Gnome::Gio
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Gio/File.rakumod
### ----------------------------------------------------
### -- Chunk 2 of 6
cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $callback; (scope async): a B<Gnome::Gio::AsyncReadyCallback> to call when the request is satisfied
=item $user_data; (closure): the data to pass to callback function
=end pod

method create-readwrite-async ( UInt $flags, Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_create_readwrite_async(
    self._get-native-object-no-reffing, $flags, $io_priority, $cancellable, $callback, $user_data
  );
}

sub g_file_create_readwrite_async (
  N-GFile $file, GFlag $flags, int $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:create-readwrite-finish:
=begin pod
=head2 create-readwrite-finish

Finishes an asynchronous file create operation started with C<create-readwrite-async()>.

Returns: a B<Gnome::Gio::FileIOStream> or C<undefined> on error. Free the returned object with C<clear-object()>.

  method create-readwrite-finish ( GAsyncResult $res, N-GError $error --> GFileIOStream )

=item $res; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>, or C<undefined>
=end pod

method create-readwrite-finish ( GAsyncResult $res, $error is copy --> GFileIOStream ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_create_readwrite_finish(
    self._get-native-object-no-reffing, $res, $error
  )
}

sub g_file_create_readwrite_finish (
  N-GFile $file, GAsyncResult $res, N-GError $error --> GFileIOStream
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:delete:
=begin pod
=head2 delete

Deletes a file. If the I<file> is a directory, it will only be deleted if it is empty. This has the same semantics as C<g-unlink()>.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

Virtual: delete-file

Returns: C<True> if the file was deleted. C<False> otherwise.

  method delete ( GCancellable $cancellable, N-GError $error --> Bool )

=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $error; a B<Gnome::Gio::Error>, or C<undefined>
=end pod

method delete ( GCancellable $cancellable, $error is copy --> Bool ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_delete(
    self._get-native-object-no-reffing, $cancellable, $error
  ).Bool
}

sub g_file_delete (
  N-GFile $file, GCancellable $cancellable, N-GError $error --> gboolean
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:delete-async:
=begin pod
=head2 delete-async

Asynchronously delete a file. If the I<file> is a directory, it will only be deleted if it is empty. This has the same semantics as C<g-unlink()>.

Virtual: delete-file-async

  method delete-async ( Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data )

=item $io_priority; the [I/O priority][io-priority] of the request
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $callback; a B<Gnome::Gio::AsyncReadyCallback> to call when the request is satisfied
=item $user_data; the data to pass to callback function
=end pod

method delete-async ( Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_delete_async(
    self._get-native-object-no-reffing, $io_priority, $cancellable, $callback, $user_data
  );
}

sub g_file_delete_async (
  N-GFile $file, int $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:delete-finish:
=begin pod
=head2 delete-finish

Finishes deleting a file started with C<delete-async()>.

Virtual: delete-file-finish

Returns: C<True> if the file was deleted. C<False> otherwise.

  method delete-finish ( GAsyncResult $result, N-GError $error --> Bool )

=item $result; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>, or C<undefined>
=end pod

method delete-finish ( GAsyncResult $result, $error is copy --> Bool ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_delete_finish(
    self._get-native-object-no-reffing, $result, $error
  ).Bool
}

sub g_file_delete_finish (
  N-GFile $file, GAsyncResult $result, N-GError $error --> gboolean
) is native(&gio-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:0:dup:
=begin pod
=head2 dup

Duplicates a B<Gnome::Gio::File> handle. This operation does not duplicate the actual file or directory represented by the B<Gnome::Gio::File>; see C<copy()> if attempting to copy a file.

C<g-file-dup()> is useful when a second handle is needed to the same underlying file, for use in a separate thread (B<Gnome::Gio::File> is not thread-safe). For use within the same thread, use C<g-object-ref()> to increment the existing object’s reference count.

This call does no blocking I/O.

Returns: a new B<Gnome::Gio::File> that is a duplicate of the given B<Gnome::Gio::File>.

  method dup ( --> N-GFile )

=end pod

method dup ( --> N-GFile ) {

  g_file_dup(
    self._get-native-object-no-reffing,
  )
}

sub g_file_dup (
  N-GFile $file --> N-GFile
) is native(&gio-lib)
  { * }
}}
#`{{
#-------------------------------------------------------------------------------
# TM:0:eject-mountable-with-operation:
=begin pod
=head2 eject-mountable-with-operation

Starts an asynchronous eject on a mountable. When this operation has completed, I<callback> will be called with I<user-user> data, and the operation can be finalized with C<eject-mountable-with-operation-finish()>.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

  method eject-mountable-with-operation ( GMountUnmountFlags $flags, GMountOperation $mount_operation, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data )

=item $flags; flags affecting the operation
=item $mount_operation; a B<Gnome::Gio::MountOperation>, or C<undefined> to avoid user interaction
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $callback; (scope async) : a B<Gnome::Gio::AsyncReadyCallback> to call when the request is satisfied, or C<undefined>
=item $user_data; (closure): the data to pass to callback function
=end pod

method eject-mountable-with-operation ( GMountUnmountFlags $flags, GMountOperation $mount_operation, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_eject_mountable_with_operation(
    self._get-native-object-no-reffing, $flags, $mount_operation, $cancellable, $callback, $user_data
  );
}

sub g_file_eject_mountable_with_operation (
  N-GFile $file, GFlag $flags, GMountOperation $mount_operation, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:eject-mountable-with-operation-finish:
=begin pod
=head2 eject-mountable-with-operation-finish

Finishes an asynchronous eject operation started by C<eject-mountable-with-operation()>.

Returns: C<True> if the I<file> was ejected successfully. C<False> otherwise.

  method eject-mountable-with-operation-finish ( GAsyncResult $result, N-GError $error --> Bool )

=item $result; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>, or C<undefined>
=end pod

method eject-mountable-with-operation-finish ( GAsyncResult $result, $error is copy --> Bool ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_eject_mountable_with_operation_finish(
    self._get-native-object-no-reffing, $result, $error
  ).Bool
}

sub g_file_eject_mountable_with_operation_finish (
  N-GFile $file, GAsyncResult $result, N-GError $error --> gboolean
) is native(&gio-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:0:enumerate-children:
=begin pod
=head2 enumerate-children

Gets the requested information about the files in a directory. The result is a B<Gnome::Gio::FileEnumerator> object that will give out B<Gnome::Gio::FileInfo> objects for all the files in the directory.

The I<attributes> value is a string that specifies the file attributes that should be gathered. It is not an error if it's not possible to read a particular requested attribute from a file - it just won't be set. I<attributes> should be a comma-separated list of attributes or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "standard::*" means all attributes in the standard namespace. An example attribute query be "standard::*,owner::user". The standard attributes are available as defines, like B<Gnome::Gio::-FILE-ATTRIBUTE-STANDARD-NAME>.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

If the file does not exist, the C<G-IO-ERROR-NOT-FOUND> error will be returned. If the file is not a directory, the C<G-IO-ERROR-NOT-DIRECTORY> error will be returned. Other errors are possible too.

Returns: A B<Gnome::Gio::FileEnumerator> if successful, C<undefined> on error. Free the returned object with C<clear-object()>.

  method enumerate-children ( Str $attributes, GFileQueryInfoFlags $flags, GCancellable $cancellable, N-GError $error --> GFileEnumerator )

=item $attributes; an attribute query string
=item $flags; a set of B<Gnome::Gio::FileQueryInfoFlags>
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $error; B<Gnome::Gio::Error> for error reporting
=end pod

method enumerate-children ( Str $attributes, GFileQueryInfoFlags $flags, GCancellable $cancellable, $error is copy --> GFileEnumerator ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_enumerate_children(
    self._get-native-object-no-reffing, $attributes, $flags, $cancellable, $error
  )
}

sub g_file_enumerate_children (
  N-GFile $file, gchar-ptr $attributes, GFlag $flags, GCancellable $cancellable, N-GError $error --> GFileEnumerator
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:enumerate-children-async:
=begin pod
=head2 enumerate-children-async

Asynchronously gets the requested information about the files in a directory. The result is a B<Gnome::Gio::FileEnumerator> object that will give out B<Gnome::Gio::FileInfo> objects for all the files in the directory.

For more details, see C<enumerate-children()> which is the synchronous version of this call.

When the operation is finished, I<callback> will be called. You can then call C<g-file-enumerate-children-finish()> to get the result of the operation.

  method enumerate-children-async ( Str $attributes, GFileQueryInfoFlags $flags, Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data )

=item $attributes; an attribute query string
=item $flags; a set of B<Gnome::Gio::FileQueryInfoFlags>
=item $io_priority; the [I/O priority][io-priority] of the request
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $callback; (scope async): a B<Gnome::Gio::AsyncReadyCallback> to call when the request is satisfied
=item $user_data; (closure): the data to pass to callback function
=end pod

method enumerate-children-async ( Str $attributes, GFileQueryInfoFlags $flags, Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_enumerate_children_async(
    self._get-native-object-no-reffing, $attributes, $flags, $io_priority, $cancellable, $callback, $user_data
  );
}

sub g_file_enumerate_children_async (
  N-GFile $file, gchar-ptr $attributes, GFlag $flags, int $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:enumerate-children-finish:
=begin pod
=head2 enumerate-children-finish

Finishes an async enumerate children operation. See C<enumerate-children-async()>.

Returns: a B<Gnome::Gio::FileEnumerator> or C<undefined> if an error occurred. Free the returned object with C<clear-object()>.

  method enumerate-children-finish ( GAsyncResult $res, N-GError $error --> GFileEnumerator )

=item $res; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>
=end pod

method enumerate-children-finish ( GAsyncResult $res, $error is copy --> GFileEnumerator ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_enumerate_children_finish(
    self._get-native-object-no-reffing, $res, $error
  )
}

sub g_file_enumerate_children_finish (
  N-GFile $file, GAsyncResult $res, N-GError $error --> GFileEnumerator
) is native(&gio-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:0:equal:
=begin pod
=head2 equal

Checks if the two given B<Gnome::Gio::Files> refer to the same file.

Note that two B<Gnome::Gio::Files> that differ can still refer to the same file on the filesystem due to various forms of filename aliasing.

This call does no blocking I/O.

Returns: C<True> if I<file1> and I<file2> are equal.

  method equal ( N-GFile $file2 --> Bool )

=item $file2; the second B<Gnome::Gio::File>
=end pod

method equal ( N-GFile $file2 --> Bool ) {

  g_file_equal(
    self._get-native-object-no-reffing, $file2
  ).Bool
}

sub g_file_equal (
  N-GFile $file1, N-GFile $file2 --> gboolean
) is native(&gio-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:0:find-enclosing-mount:
=begin pod
=head2 find-enclosing-mount

Gets a B<Gnome::Gio::Mount> for the B<Gnome::Gio::File>.

If the B<Gnome::Gio::FileIface> for I<file> does not have a mount (e.g. possibly a remote share), I<error> will be set to C<G-IO-ERROR-NOT-FOUND> and C<undefined> will be returned.

If I<cancellable> is not C<undefined>, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error C<G-IO-ERROR-CANCELLED> will be returned.

Returns: a B<Gnome::Gio::Mount> where the I<file> is located or C<undefined> on error. Free the returned object with C<clear-object()>.

  method find-enclosing-mount ( GCancellable $cancellable, N-GError $error --> GMount )

=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $error; a B<Gnome::Gio::Error>
=end pod

method find-enclosing-mount ( GCancellable $cancellable, $error is copy --> GMount ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_find_enclosing_mount(
    self._get-native-object-no-reffing, $cancellable, $error
  )
}

sub g_file_find_enclosing_mount (
  N-GFile $file, GCancellable $cancellable, N-GError $error --> GMount
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:find-enclosing-mount-async:
=begin pod
=head2 find-enclosing-mount-async

Asynchronously gets the mount for the file.

For more details, see C<find-enclosing-mount()> which is the synchronous version of this call.

When the operation is finished, I<callback> will be called. You can then call C<g-file-find-enclosing-mount-finish()> to get the result of the operation.

  method find-enclosing-mount-async ( Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data )

=item $io_priority; the [I/O priority][io-priority] of the request
=item $cancellable; optional B<Gnome::Gio::Cancellable> object, C<undefined> to ignore
=item $callback; (scope async): a B<Gnome::Gio::AsyncReadyCallback> to call when the request is satisfied
=item $user_data; (closure): the data to pass to callback function
=end pod

method find-enclosing-mount-async ( Int() $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, Pointer $user_data ) {

  g_file_find_enclosing_mount_async(
    self._get-native-object-no-reffing, $io_priority, $cancellable, $callback, $user_data
  );
}

sub g_file_find_enclosing_mount_async (
  N-GFile $file, int $io_priority, GCancellable $cancellable, GAsyncReadyCallback $callback, gpointer $user_data
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
# TM:0:find-enclosing-mount-finish:
=begin pod
=head2 find-enclosing-mount-finish

Finishes an asynchronous find mount request. See C<find-enclosing-mount-async()>.

Returns: B<Gnome::Gio::Mount> for given I<file> or C<undefined> on error. Free the returned object with C<clear-object()>.

  method find-enclosing-mount-finish ( GAsyncResult $res, N-GError $error --> GMount )

=item $res; a B<Gnome::Gio::AsyncResult>
=item $error; a B<Gnome::Gio::Error>
=end pod

method find-enclosing-mount-finish ( GAsyncResult $res, $error is copy --> GMount ) {
  $error .= _get-native-object-no-reffing unless $error ~~ N-GError;

  g_file_find_enclosing_mount_finish(
    self._get-native-object-no-reffing, $res, $error
  )
}

sub g_file_find_enclosing_mount_finish (
  N-GFile $file, GAsyncResult $res, N-GError $error --> GMount
) is native(&gio-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:get-basename:
=begin pod
=head2 get-basename

Gets the base name (the last component of the path) for a given B<Gnome::Gio::File>.

If called for the top level of a system (such as the filesystem root or a uri like sftp://host/) it will return a single directory separator (and on Windows, possibly a drive letter).

The base name is a byte string (not UTF-8). It has no defined encoding or rules other than it may not contain zero bytes. If you want to use filenames in a user interface you should use the display name that you can get by requesting the C<G-FILE-ATTRIBUTE-STANDARD-DISPLAY-NAME> attribute with C<query-info()>.

This call does no blocking I/O.

Returns: (type filename) : string containing the B<Gnome::Gio::File>'s base name, or C<undefined> if given B<Gnome::Gio::File> is invalid. The returned string should be freed with C<g-free()> when no longer needed.

  method get-basename ( --> Str )

=end pod

method get-basename ( --> Str ) {

  g_file_get_basename(
    self._get-native-object-no-reffing,
  )
}

sub g_file_get_basename (
  N-GFile $file --> gchar-ptr
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-child:
=begin pod
=head2 get-child

Gets a child of this I<File> with basename equal to I<name>.

Note that the file with that specific name might not exist, but you can still have a B<Gnome::Gio::File> that points to it. You can use this for instance to create that file.

This call does no blocking I/O.

Returns: a B<Gnome::Gio::File> to a child specified by I<name>. Free the returned object with C<.clear-object()>.

  method get-child ( Str $name --> N-GFile )

=item $name; (type filename): string containing the child's basename
=end pod

method get-child ( Str $name --> N-GFile ) {
  g_file_get_child( self._get-native-object-no-reffing, $name)
}

method get-child-rk ( Str $name --> Gnome::Gio::File ) {
  Gnome::N::deprecate(
    'get-child-rk', 'coercing from get-child',
    '0.10.8', '0.11.0'
  );

  Gnome::Gio::File.new(
    :native-object(g_file_get_child( self._get-native-object-no-reffing, $name))
  )
}

sub g_file_get_child (
  N-GFile $file, gchar-ptr $name --> N-GFile
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-child-for-display-name:
=begin pod
=head2 get-child-for-display-name

Gets the child for a given I<display-name> (i.e. a UTF-8 version of the name). If this function fails, it returns C<undefined> and I<error> will be set. This is very useful when constructing a B<Gnome::Gio::File> for a new file and the user entered the filename in the user interface, for instance when you select a directory and type a filename in the file selector.

Returns: a native File object to the specified child, or C<undefined> if the display name couldn't be converted.

When an error takes place, the error object is set and the returned object is invalid. The error is stored in the attribute C<$.last-error>. Free the returned object with C<clear-object()>.

  method get-child-for-display-name ( Str $display-name --> N-GFile )

=head3 Example

  my Gnome::Gio::File $f .= new(:path<t/data/g-resources>);
  my Gnome::Gio::File() $f2 = $f.get-child-for-display-name('rtest')
  die $f.last-error.message unless $f2.is-valid;


=item $display_name; string to a possible child
=end pod

method get-child-for-display-name ( Str $display_name --> N-GFile ) {
  my CArray[N-GError] $error .= new(N-GError);

  my N-GFile $no = g_file_get_child_for_display_name(
    self._get-native-object-no-reffing, $display_name, $error
  );

  $!last-error.clear-object;
  $!last-error = Gnome::Glib::Error.new(:native-object($error[0]));
  
  $no
}

method get-child-for-display-name-rk (
  Str $display_name --> Gnome::Gio::File
) {
  Gnome::N::deprecate(
    'get-child-for-display-name-rk', 'coercing from get-child-for-display-name',
    '0.10.8', '0.11.0'
  );

  my CArray[N-GError] $error .= new(N-GError);

  my N-GFile $no = g_file_get_child_for_display_name(
    self._get-native-object-no-reffing, $display_name, $error
  );

  $!last-error.clear-object;
  $!last-error = Gnome::Glib::Error.new(:native-object($error[0]));
  Gnome::Gio::File.new(:native-object($no))
}

sub g_file_get_child_for_display_name (
  N-GFile $file, gchar-ptr $display_name, CArray[N-GError] $error --> N-GFile
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-parent:
=begin pod
=head2 get-parent

Gets the parent directory for the I<file>. If the I<file> represents the root directory of the file system, then C<undefined> will be returned.

This call does no blocking I/O.

Returns: a B<Gnome::Gio::File> structure to the parent of the given B<Gnome::Gio::File> or C<undefined> if there is no parent. Free the returned object with C<clear-object()>.

  method get-parent ( --> N-GFile )

=end pod

method get-parent ( --> N-GFile ) {
  g_file_get_parent(self._get-native-object-no-reffing)
}

method get-parent-rk ( --> Gnome::Gio::File ) {
  Gnome::N::deprecate(
    'get-parent-rk', 'coercing from get-parent',
    '0.10.8', '0.11.0'
  );

  Gnome::Gio::File.new(
    :native-object(g_file_get_parent(self._get-native-object-no-reffing))
  )
}

sub g_file_get_parent (
  N-GFile $file --> N-GFile
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-parse-name:
=begin pod
=head2 get-parse-name

Gets the parse name of the I<file>. A parse name is a UTF-8 string that describes the file such that one can get the B<Gnome::Gio::File> back using C<parse-name()>.

This is generally used to show the B<Gnome::Gio::File> as a nice full-pathname kind of string in a user interface, like in a location entry.

For local files with names that can safely be converted to UTF-8 the pathname is used, otherwise the IRI is used (a form of URI that allows UTF-8 characters unescaped).

This call does no blocking I/O.

Returns: a string containing the B<Gnome::Gio::File>'s parse name.
=comment TODO The returned string should be freed with C<g-free()> when no longer needed.

  method get-parse-name ( --> Str )

=end pod

method get-parse-name ( --> Str ) {

  g_file_get_parse_name(
    self._get-native-object-no-reffing,
  )
}

sub g_file_get_parse_name (
  N-GFile $file --> gchar-ptr
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-path:
=begin pod
=head2 get-path

Gets the local pathname for B<Gnome::Gio::File>, if one exists. If non-C<undefined>, this is guaranteed to be an absolute, canonical path. It might contain symlinks.

This call does no blocking I/O.

Returns: (type filename) : string containing the B<Gnome::Gio::File>'s path, or C<undefined> if no such path exists. The returned string should be freed with C<g-free()> when no longer needed.

  method get-path ( --> Str )

=end pod

method get-path ( --> Str ) {

  g_file_get_path(
    self._get-native-object-no-reffing,
  )
}

sub g_file_get_path (
  N-GFile $file --> gchar-ptr
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-relative-path:
=begin pod
=head2 get-relative-path

Gets the path for I<descendant> relative to I<parent>.

This call does no blocking I/O.

Returns: string with the relative path from I<descendant> to I<parent>, or C<undefined> if I<descendant> doesn't have I<parent> as prefix.
=comment TODO The returned string should be freed with C<g-free()> when no longer needed.

  method get-relative-path ( N-GFile $descendant --> Str )

=item $descendant; input B<Gnome::Gio::File>
=end pod

method get-relative-path ( $descendant is copy --> Str ) {
  $descendant .= _get-native-object-no-reffing unless $descendant ~~ N-GFile;
  g_file_get_relative_path( self._get-native-object-no-reffing, $descendant)
}

sub g_file_get_relative_path (
  N-GFile $parent, N-GFile $descendant --> gchar-ptr
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-uri:
=begin pod
=head2 get-uri

Gets the URI for the I<file>.

This call does no blocking I/O.

Returns: a string containing the B<Gnome::Gio::File>'s URI. The returned string should be freed with C<g-free()> when no longer needed.

  method get-uri ( --> Str )

=end pod

method get-uri ( --> Str ) {

  g_file_get_uri(
    self._get-native-object-no-reffing,
  )
}

sub g_file_get_uri (
  N-GFile $file --> gchar-ptr
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-uri-scheme:
=begin pod
=head2 get-uri-scheme

Gets the URI scheme for a B<Gnome::Gio::File>. RFC 3986 decodes the scheme as:

  URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

Common schemes include "file", "http", "ftp", etc.

This call does no blocking I/O.

Returns: a string containing the URI scheme for the given B<Gnome::Gio::File>. The returned string should be freed with C<g-free()> when no longer needed.

  method get-uri-scheme ( --> Str )

=end pod

method get-uri-scheme ( --> Str ) {
  g_file_get_uri_scheme(self._get-native-object-no-reffing)
}

sub g_file_get_uri_scheme (
  N-GFile $file --> gchar-ptr
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:has-parent:
=begin pod
=head2 has-parent

Checks if I<file> has a parent, and optionally, if it is I<parent>.

If I<parent> is C<undefined> then this function returns C<True> if I<file> has any parent at all. If I<parent> is non-C<undefined> then C<True> is only returned if I<file> is an immediate child of I<parent>.

Returns: C<True> if I<file> is an immediate child of I<parent> (or any parent in the case that I<parent> is C<undefined>).

  method has-parent ( N-GFile $parent --> Bool )

=item $parent; the parent to check for, or C<undefined>
=end pod

method has-parent ( $parent is copy --> Bool ) {
  $parent .= _get-native-object-no-reffing unless $parent ~~ N-GFile;
  g_file_has_parent( self._get-native-object-no-reffing, $parent).Bool
}

sub g_file_has_parent (
  N-GFile $file, N-GFile $parent --> gboolean
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:has-prefix:
=begin pod
=head2 has-prefix

Checks whether I<file> has the prefix specified by I<prefix>.

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

A B<Gnome::Gio::File> is not a prefix of itself. If you want to check for equality, use C<equal()>.

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

Virtual: prefix-matches

Returns: C<True> if the I<files>'s parent, grandparent, etc is I<prefix>, C<False> otherwise.

  method has-prefix ( N-GFile $prefix --> Bool )

=item $prefix; input B<Gnome::Gio::File>
=end pod

method has-prefix ( $prefix is copy --> Bool ) {
  $prefix .= _get-native-object-no-reffing unless $prefix ~~ N-GFile;
  g_file_has_prefix( self._get-native-object-no-reffing, $prefix).Bool
}

sub g_file_has_prefix (
  N-GFile $file, N-GFile $prefix --> gboolean
) is native(&gio-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:has-uri-scheme:
=begin pod
=head2 has-uri-scheme

Checks to see if a B<Gnome::Gio::File> has a given URI scheme.

This call does no blocking I/O.

Returns: C<True> if B<Gnome::Gio::File>'s backend supports the given URI scheme, C<False> if URI scheme is C<undefined>, not supported, or B<Gnome::Gio::File> is invalid.

  method has-uri-scheme ( Str $uri_scheme --> Bool )

=item $uri_scheme; a string containing a URI scheme
=end pod

method has-uri-scheme ( Str $uri_scheme --> Bool ) {
  g_file_has_uri_scheme( self._get-native-object-no-reffing, $uri_scheme).Bool
}

sub g_file_has_uri_scheme (
  N-GFile $file, gchar-ptr $uri_scheme --> gboolean
) is native(&gio-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
# TM:0:hash:
=begin pod
=head2 hash

Creates a hash value for a B<Gnome::Gio::File>.

This call does no blocking I/O.

Virtual: hash

Returns: 0 if I<file> is not a valid B<Gnome::Gio::File>, otherwise an integer that can be used as hash value for the B<Gnome::Gio::File>. This function is intended for easily hashing a B<Gnome::Gio::File> to add to a B<Gnome::Gio::HashTable> or similar data structure.

  method hash ( Pointer $file --> UInt )

=item $file; (type N-GFile): B<gconstpointer> to a B<Gnome::Gio::File>
=end pod

method hash ( Pointer $file --> UInt ) {

  g_file_hash(
    self._get-native-object-no-reffing, $file
  )
}

sub g_file_hash (
  gpointer $file --> guint
) is native(&gio-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:is-native:
=begin pod
=head2 is-native

Checks to see if a file is native to the platform.

A native file is one expressed in the platform-native filename format