+ return dir;
+}
+
+#if defined (G_OS_WIN32) && !defined (_WIN64)
+
+/* The above function actually is called g_dir_open_utf8, and it's
+ * that what applications compiled with this GLib version will
+ * use.
+ */
+
+#undef g_dir_open
+
+/* Binary compatibility version. Not for newly compiled code. */
+
+GDir *
+g_dir_open (const gchar *path,
+ guint flags,
+ GError **error)
+{
+ gchar *utf8_path = g_locale_to_utf8 (path, -1, NULL, NULL, error);
+ GDir *retval;
+
+ if (utf8_path == NULL)
+ return NULL;
+
+ retval = g_dir_open_utf8 (utf8_path, flags, error);
+
+ g_free (utf8_path);
+
+ return retval;
+}
+#endif
+
+/*< private >
+ * g_dir_new_from_dirp:
+ * @dirp: a #DIR* created by opendir() or fdopendir()
+ *
+ * Creates a #GDir object from the DIR object that is created using
+ * opendir() or fdopendir(). The created #GDir assumes ownership of the
+ * passed-in #DIR pointer.
+ *
+ * @dirp must not be %NULL.
+ *
+ * This function never fails.
+ *
+ * Returns: a newly allocated #GDir, which should be closed using
+ * g_dir_close().
+ *
+ * Since: 2.38
+ **/
+GDir *
+g_dir_new_from_dirp (gpointer dirp)
+{
+#ifdef G_OS_UNIX
+ GDir *dir;
+
+ g_return_val_if_fail (dirp != NULL, NULL);
+
+ dir = g_new (GDir, 1);
+ dir->dirp = dirp;
+
+ return dir;
+#else
+ g_assert_not_reached ();
+#endif