diff options
author | Tor Lillqvist <tml@iki.fi> | 2004-12-12 21:09:13 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2004-12-12 21:09:13 +0000 |
commit | f3da17053918abe78db5f75e7d008e4c84c09570 (patch) | |
tree | 8ec4255ddb86a9d13de0e6012246a64f4cc671e3 /gtk/updateiconcache.c | |
parent | f821217218c60a96cda40844fbef300b4b3d143b (diff) | |
download | gtk+-f3da17053918abe78db5f75e7d008e4c84c09570.tar.gz |
gtk/gtkaccelmap.[ch] gtk/gtkfilechooser.[ch] gtk/gtkfilesel.c
2004-12-12 Tor Lillqvist <tml@iki.fi>
* gtk/gtkaccelmap.[ch]
* gtk/gtkfilechooser.[ch]
* gtk/gtkfilesel.c
* gtk/gtkfilesystemwin32.c
* gtk/gtkiconfactory.[ch]
* gtk/gtkicontheme.[ch]
* gtk/gtkimage.[ch]
* gtk/gtkimmodule.c
* gtk/gtkmodules.c
* gtk/gtkrc.[ch]
* gtk/gtkuimanager.[ch]
* gtk/gtkwindow.[ch]
* gtk/updateiconcache.c
* gtk/gtk.symbols: Use gstdio wrappers. On Windows, convert
environment variables referring to pathnames from locale encoding
to UTF-8. As in GLib, in order to preserve Windows DLL ABI
stability, add binary compatibility versions of functions that
take file names as arguments, or return file names. Add a _utf8
suffix to the "real" such functions on Windows. The ABI
compatibility versions keep the old name.
* gtk/Makefile.am: Strip PRIVATE symbols from the GNU import
library.
* gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path): Implement
file mapping on Win32.
* gtk/updateiconcache.c: Don't crash if invoked without
argument. Use binary mode when opening file.
* modules/engines/ms-windows/Theme/gtk-2.0/Makefile.am: Install
gtkrc in correct place, in <datadir>/themes/MS-Windows/gtk-2.0.
Diffstat (limited to 'gtk/updateiconcache.c')
-rw-r--r-- | gtk/updateiconcache.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/gtk/updateiconcache.c b/gtk/updateiconcache.c index 4bf31ec656..5231a064b6 100644 --- a/gtk/updateiconcache.c +++ b/gtk/updateiconcache.c @@ -27,6 +27,7 @@ #include <utime.h> #include <glib.h> +#include <glib/gstdio.h> #define CACHE_NAME "icon-theme.cache" @@ -49,7 +50,7 @@ is_cache_up_to_date (const gchar *path) gchar *cache_path; int retval; - retval = stat (path, &path_stat); + retval = g_stat (path, &path_stat); if (retval < 0) { @@ -59,7 +60,7 @@ is_cache_up_to_date (const gchar *path) } cache_path = g_build_filename (path, CACHE_NAME, NULL); - retval = stat (cache_path, &cache_stat); + retval = g_stat (cache_path, &cache_stat); g_free (cache_path); if (retval < 0 && errno == ENOENT) @@ -554,7 +555,7 @@ build_cache (const gchar *path) GList *directories = NULL; tmp_cache_path = g_build_filename (path, "."CACHE_NAME, NULL); - cache = fopen (tmp_cache_path, "w"); + cache = g_fopen (tmp_cache_path, "wb"); if (!cache) { @@ -571,7 +572,7 @@ build_cache (const gchar *path) /* Empty table, just close and remove the file */ fclose (cache); - unlink (tmp_cache_path); + g_unlink (tmp_cache_path); exit (0); } @@ -584,22 +585,22 @@ build_cache (const gchar *path) if (!retval) { - unlink (tmp_cache_path); + g_unlink (tmp_cache_path); exit (1); } cache_path = g_build_filename (path, CACHE_NAME, NULL); - if (rename (tmp_cache_path, cache_path) == -1) + if (g_rename (tmp_cache_path, cache_path) == -1) { - unlink (tmp_cache_path); + g_unlink (tmp_cache_path); exit (1); } /* Update time */ /* FIXME: What do do if an error occurs here? */ - stat (path, &path_stat); - stat (cache_path, &cache_stat); + g_stat (path, &path_stat); + g_stat (cache_path, &cache_stat); utime_buf.actime = path_stat.st_atime; utime_buf.modtime = cache_stat.st_mtime; @@ -621,12 +622,18 @@ main (int argc, char **argv) gchar *path; GOptionContext *context; + if (argc < 2) + return 0; + context = g_option_context_new ("ICONPATH"); g_option_context_add_main_entries (context, args, NULL); g_option_context_parse (context, &argc, &argv, NULL); path = argv[1]; +#ifdef G_OS_WIN32 + path = g_locale_to_utf8 (path, -1, NULL, NULL, NULL); +#endif if (!force_update && is_cache_up_to_date (path)) return 0; |