## ide-gfile ide-gfile |

## Functions

void | (*IdeFileWalkCallback) ()
gboolean | ide_path_is_ignored ()
gboolean | ide_g_file_is_ignored ()
void | ide_g_file_add_ignored_pattern ()
gchar * | ide_g_file_get_uncanonical_relative_path ()
GPtrArray * | ide_g_file_find_with_depth ()
void | ide_g_file_find_with_depth_async ()
void | ide_g_file_find_async ()
GPtrArray * | ide_g_file_find_finish ()
void | ide_g_file_get_children_async ()
GPtrArray * | ide_g_file_get_children_finish ()
gboolean | ide_g_host_file_get_contents ()
void | ide_g_file_walk ()
void | ide_g_file_walk_with_ignore ()
void | ide_g_file_find_in_ancestors_async ()
GFile * | ide_g_file_find_in_ancestors_finish ()

## Description

## Functions

### IdeFileWalkCallback ()

    void
    (*IdeFileWalkCallback) (GFile *directory,
                            GPtrArray *file_infos,
                            gpointer user_data);

#### Parameters

directory | a GFile of the directory |
file_infos | array of GFileInfo children of `directory` . | [element-type GFileInfo]
user_data | user data for callback |

### ide_path_is_ignored ()

    gboolean
    ide_path_is_ignored (const gchar *path);

Checks if `path` should be ignored using the global file ignores registered with Builder.

#### Parameters

path | the path to the file |

#### Returns

`TRUE` if `path` should be ignored, otherwise `FALSE`

Since: 3.32

### ide_g_file_is_ignored ()

    gboolean
    ide_g_file_is_ignored (GFile *file);

Checks if `file` should be ignored using the internal ignore rules. If you care about the version control system, see IdeVcs and `ide_vcs_is_ignored()`.

#### Parameters

file | a GFile |

#### Returns

`TRUE` if `file` should be ignored; otherwise `FALSE`.

Since: 3.32

### ide_g_file_add_ignored_pattern ()

    void
    ide_g_file_add_ignored_pattern (const gchar *pattern);

Adds a pattern that can be used to match ingored files. These are global to the application, so they should only include well-known ignored files such as those internal to a build system, or version control system, and similar.

#### Parameters

pattern | a GPatternSpec style glob pattern |

Since: 3.32

### ide_g_file_get_uncanonical_relative_path ()

    gchar *
    ide_g_file_get_uncanonical_relative_path
                                   (GFile *file,
                                    GFile *other);

This function is similar to `g_file_get_relative_path()` except that `file` and `other` only need to have a shared common ancestor.

This is useful if you must use a relative path instead of the absolute, canonical path.

This is being implemented for use when communicating to GDB. When that becomes unnecessary, this should no longer be used.

#### Parameters

file | a GFile |
other | a GFile with a common ancestor to `file` |

#### Returns

A relative path, or `NULL` if no common ancestor was found for the relative path.

[nullable]

Since: 3.32

### ide_g_file_find_with_depth ()

    GPtrArray *
    ide_g_file_find_with_depth (GFile *file,
                                const gchar *pattern,
                                guint max_depth,
                                GCancellable *cancellable);

#### Parameters

file | a GFile |
pattern | the glob pattern to search for using GPatternSpec |
max_depth | maximum tree depth to search |
cancellable | a GCancellable or `NULL`. | [nullable]

#### Returns

a GPtrArray of GFile.

[transfer full][element-type GFile]

Since: 3.32

### ide_g_file_find_with_depth_async ()

    void
    ide_g_file_find_with_depth_async (GFile *file,
                                      const gchar *pattern,
                                      guint max_depth,
                                      GCancellable *cancellable,
                                      GAsyncReadyCallback callback,
                                      gpointer user_data);

Searches descendants of `file` for files matching `pattern` .

Only up to `max_depth` subdirectories will be searched. However, if `max_depth` is zero, then all directories will be searched.

You may only match on the filename, not the directory.

#### Parameters

file | a IdeGlib |
pattern | the glob pattern to search for using GPatternSpec |
max_depth | maximum tree depth to search |
cancellable | a GCancellable or `NULL`. | [nullable]
callback | a callback to execute upon completion |
user_data | closure data for `callback` |

Since: 3.32

### ide_g_file_find_async ()

    void
    ide_g_file_find_async (GFile *file,
                           const gchar *pattern,
                           GCancellable *cancellable,
                           GAsyncReadyCallback callback,
                           gpointer user_data);

Searches descendants of `file` for files matching `pattern` .

You may only match on the filename, not the directory.

#### Parameters

file | a IdeGlib |
pattern | the glob pattern to search for using GPatternSpec |
cancellable | a GCancellable or `NULL`. | [nullable]
callback | a callback to execute upon completion |
user_data | closure data for `callback` |

Since: 3.32

### ide_g_file_find_finish ()

    GPtrArray *
    ide_g_file_find_finish (GFile *file,
                            GAsyncResult *result,
                            GError **error);

Gets the files that were found which matched the pattern.

#### Parameters

file | a GFile |
result | a result provided to callback |
error | a location for a GError or `NULL` |

#### Returns

A GPtrArray of GFile.

[transfer full][element-type Gio.File]

Since: 3.32

### ide_g_file_get_children_async ()

    void
    ide_g_file_get_children_async (GFile *file,
                                   const gchar *attributes,
                                   GFileQueryInfoFlags flags,
                                   gint io_priority,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

This function is like `g_file_enumerate_children_async()` except that it returns a GPtrArray of GFileInfo instead of an enumerator.

This can be convenient when you know you need all of the GFileInfo accessable at once, or the size will be small.

#### Parameters

file | a IdeGlib |
attributes | attributes to retrieve |
flags | flags for the query |
io_priority | the io priority |
cancellable | a GCancellable or `NULL`. | [nullable]
callback | a callback to execute upon completion |
user_data | closure data for `callback` |

Since: 3.32

### ide_g_file_get_children_finish ()

    GPtrArray *
    ide_g_file_get_children_finish (GFile *file,
                                    GAsyncResult *result,
                                    GError **error);

Completes an asynchronous request to `ide_g_file_get_children_async()`.

#### Parameters

file | a GFile |
result | a GAsyncResult provided to callback |
error | a location for a GError, or `NULL` |

#### Returns

A GPtrArray of GFileInfo if successful, otherwise `NULL`.

[transfer full][element-type Gio.FileInfo]

Since: 3.32

### ide_g_host_file_get_contents ()

    gboolean
    ide_g_host_file_get_contents (const gchar *path,
                                  gchar **contents,
                                  gsize *len,
                                  GError **error);

This is similar to `g_file_get_contents()` but ensures that we get the file from the host, rather than our mount namespace.

#### Parameters

path | the path on the host |
contents | a location for the contents. | [out]
len | a location for the size, not including trailing \0. | [out]
error | location for a GError, or `NULL` |

#### Returns

`TRUE` if successful; otherwise `FALSE` and `error` is set.

Since: 3.32

### ide_g_file_walk ()

    void
    ide_g_file_walk (GFile *directory,
                     const gchar *attributes,
                     GCancellable *cancellable,
                     IdeFileWalkCallback callback,
                     gpointer callback_data);

Calls `callback` for every directory starting from `directory` .

All of the fileinfo for the directory will be provided to the callback for each directory.

#### Parameters

directory | a GFile that is a directory |
attributes | attributes to include in GFileInfo |
cancellable | an optional cancellable. | [nullable]
callback | a callback for each directory starting from `directory` . | [scope call]
callback_data | closure data for `callback` |

Since: 3.32

### ide_g_file_walk_with_ignore ()

    void
    ide_g_file_walk_with_ignore (GFile *directory,
                                 const gchar *attributes,
                                 const gchar *ignore_file,
                                 GCancellable *cancellable,
                                 IdeFileWalkCallback callback,
                                 gpointer callback_data);

Calls `callback` for every directory starting from `directory` .

All of the fileinfo for the directory will be provided to the callback for each directory.

If `ignore_file` is set, this function will check to see if that file exists within `directory` and skip it (and all descendants) if discovered.

#### Parameters

directory | a GFile that is a directory |
attributes | attributes to include in GFileInfo |
ignore_file | the filename within `directory` to indicate that the directory should be ignored. | [nullable]
cancellable | an optional cancellable. | [nullable]
callback | a callback for each directory starting from the `directory` . | [scope call]
callback_data | closure data for `callback` |

Since: 3.34

### ide_g_file_find_in_ancestors_async ()

    void
    ide_g_file_find_in_ancestors_async (GFile *directory,
                                        const gchar *name,
                                        GCancellable *cancellable,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);

### ide_g_file_find_in_ancestors_finish ()

    GFile *
    ide_g_file_find_in_ancestors_finish (GAsyncResult *result,
                                         GError **error);

#### Returns

a GFile if successful; otherwise `NULL` and `error` is et.

[transfer full]

Since: 3.34