- if ( errno == ENOENT)
- {
- char *tmp = g_strdup ( fn );
-#ifdef WINDOWS
- mkdir( dirname ( dirname ( tmp ) ) );
- g_free ( tmp ); tmp = g_strdup ( fn );
- mkdir( dirname ( tmp ) );
-#else
- mkdir( dirname ( dirname ( tmp ) ), 0777 );
- g_free ( tmp ); tmp = g_strdup ( fn );
- mkdir( dirname ( tmp ), 0777 );
-#endif
- g_free ( tmp );
- }
+ gchar *dir = g_path_get_dirname ( fn );
+ g_mkdir_with_parents ( dir , 0777 );
+ g_free ( dir );
+