71
* g_dir_open_with_errno:
72
* @path: the path to the directory you are interested in.
73
* @flags: Currently must be set to 0. Reserved for future use.
75
* Opens a directory for reading.
77
* This function is equivalent to g_dir_open() except in the error case,
78
* errno will be set accordingly.
80
* This is useful if you want to construct your own error message.
82
* Returns: a newly allocated #GDir on success, or %NULL on failure,
83
* with errno set accordingly.
88
g_dir_open_with_errno (const gchar *path,
97
g_return_val_if_fail (path != NULL, NULL);
100
wpath = g_utf8_to_utf16 (path, -1, NULL, NULL, NULL);
102
g_return_val_if_fail (wpath != NULL, NULL);
104
dir.wdirp = _wopendir (wpath);
109
if (dir.wdirp == NULL)
112
dir.dirp = opendir (path);
114
if (dir.dirp == NULL)
118
return g_memdup (&dir, sizeof dir);
70
123
* @path: the path to the directory you are interested in. On Unix
98
g_return_val_if_fail (path != NULL, NULL);
101
wpath = g_utf8_to_utf16 (path, -1, NULL, NULL, error);
106
dir = g_new (GDir, 1);
108
dir->wdirp = _wopendir (wpath);
119
g_file_error_from_errno (errsv),
120
_("Error opening directory '%s': %s"),
121
path, g_strerror (errsv));
127
dir = g_new (GDir, 1);
129
dir->dirp = opendir (path);
137
utf8_path = g_filename_to_utf8 (path, -1,
142
g_file_error_from_errno (errsv),
143
_("Error opening directory '%s': %s"),
144
utf8_path, g_strerror (errsv));
146
dir = g_dir_open_with_errno (path, flags);
154
utf8_path = g_filename_to_utf8 (path, -1, NULL, NULL, NULL);
156
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (saved_errno),
157
_("Error opening directory '%s': %s"), utf8_path, g_strerror (saved_errno));
153
164
#if defined (G_OS_WIN32) && !defined (_WIN64)
195
* g_dir_new_from_dirp:
196
* @dirp: a #DIR* created by opendir() or fdopendir()
198
* Creates a #GDir object from the DIR object that is created using
199
* opendir() or fdopendir(). The created #GDir assumes ownership of the
200
* passed-in #DIR pointer.
202
* @dirp must not be %NULL.
204
* This function never fails.
206
* Returns: a newly allocated #GDir, which should be closed using
212
g_dir_new_from_dirp (gpointer dirp)
217
g_return_val_if_fail (dirp != NULL, NULL);
219
dir = g_new (GDir, 1);
224
g_assert_not_reached ();
184
229
* g_dir_read_name:
185
230
* @dir: a #GDir* created by g_dir_open()