Группа :: Графические оболочки/Прочее
Пакет: shared-mime-info
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: shared-mime-info-0.13-alt-cachedir.patch
diff -durN shared-mime-info-0.13.orig/update-mime-database.c shared-mime-info-0.13/update-mime-database.c
--- shared-mime-info-0.13.orig/update-mime-database.c 2003-10-13 13:43:38 +0400
+++ shared-mime-info-0.13/update-mime-database.c 2004-03-05 19:14:10 +0300
@@ -100,7 +100,7 @@
static void usage(const char *name)
{
- fprintf(stderr, _("Usage: %s [-hv] MIME-DIR\n"), name);
+ fprintf(stderr, _("Usage: %s [-hv] MIME-DIR CACHE-DIR\n"), name);
}
static void free_type(gpointer data)
@@ -1374,6 +1374,7 @@
int main(int argc, char **argv)
{
char *mime_dir = NULL;
+ char *cache_dir = NULL;
char *package_dir = NULL;
int opt;
@@ -1397,7 +1398,7 @@
}
}
- if (optind != argc - 1)
+ if (optind != argc - 2)
{
usage(argv[0]);
return EXIT_FAILURE;
@@ -1406,6 +1407,7 @@
LIBXML_TEST_VERSION;
mime_dir = argv[optind];
+ cache_dir = argv[optind + 1];
/* Strip trailing / characters */
{
@@ -1417,16 +1419,30 @@
}
}
+ {
+ int l = strlen(cache_dir);
+ while (l > 1 && cache_dir[l - 1] == '/')
+ {
+ l--;
+ cache_dir[l] = '\0';
+ }
+ }
+
package_dir = g_strconcat(mime_dir, "/packages", NULL);
- if (access(mime_dir, W_OK))
+ if (access(mime_dir, F_OK))
{
- g_printerr(_("%s: I don't have write permission on %s.\n"
- "Try rerunning me as root.\n"), argv[0], mime_dir);
+ fprintf(stderr,
+ _("Directory '%s' does not exist!\n"), package_dir);
return EXIT_FAILURE;
}
- g_print("***\n* Updating MIME database in %s...\n", mime_dir);
+ if (access(cache_dir, W_OK))
+ {
+ g_printerr(_("%s: I don't have write permission on %s.\n"
+ "Try rerunning me as root.\n"), argv[0], cache_dir);
+ return EXIT_FAILURE;
+ }
if (access(package_dir, F_OK))
{
@@ -1435,6 +1451,8 @@
return EXIT_FAILURE;
}
+ g_print("***\n* Updating MIME database in %s...\n", cache_dir);
+
types = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, free_type);
globs_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
@@ -1446,14 +1464,14 @@
scan_source_dir(package_dir);
g_free(package_dir);
- delete_old_types(mime_dir);
+ delete_old_types(cache_dir);
- g_hash_table_foreach(types, write_out_type, (gpointer) mime_dir);
+ g_hash_table_foreach(types, write_out_type, (gpointer) cache_dir);
{
FILE *globs;
char *globs_path;
- globs_path = g_strconcat(mime_dir, "/globs.new", NULL);
+ globs_path = g_strconcat(cache_dir, "/globs.new", NULL);
globs = fopen(globs_path, "wb");
if (!globs)
g_error("Failed to open '%s' for writing\n",
@@ -1472,7 +1490,7 @@
FILE *stream;
char *magic_path;
int i;
- magic_path = g_strconcat(mime_dir, "/magic.new", NULL);
+ magic_path = g_strconcat(cache_dir, "/magic.new", NULL);
stream = fopen(magic_path, "wb");
if (!stream)
g_error("Failed to open '%s' for writing\n",
@@ -1499,7 +1517,7 @@
FILE *stream;
char *ns_path;
- ns_path = g_strconcat(mime_dir, "/XMLnamespaces.new", NULL);
+ ns_path = g_strconcat(cache_dir, "/XMLnamespaces.new", NULL);
stream = fopen(ns_path, "wb");
if (!stream)
g_error("Failed to open '%s' for writing\n",
@@ -1519,7 +1537,7 @@
g_print("***\n");
- check_in_path_xdg_data(mime_dir);
+ check_in_path_xdg_data(cache_dir);
return EXIT_SUCCESS;
}