summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTing-Wei Lan <lantw44@gmail.com>2013-08-01 13:04:13 +0800
committerLAN-TW <lantw44@gmail.com>2013-08-01 13:04:13 +0800
commit9e31292e45032aacf09f183e409a7b3627c5034d (patch)
tree7f7b769b82b2c8b1b424feff5da657a5a24b27b3
parent7d1ac45c887b582a28ab19739993ae0a2a3e8881 (diff)
downloadgsoc2013-libgnome-autoar-9e31292e45032aacf09f183e409a7b3627c5034d.tar
gsoc2013-libgnome-autoar-9e31292e45032aacf09f183e409a7b3627c5034d.tar.gz
gsoc2013-libgnome-autoar-9e31292e45032aacf09f183e409a7b3627c5034d.tar.bz2
gsoc2013-libgnome-autoar-9e31292e45032aacf09f183e409a7b3627c5034d.tar.lz
gsoc2013-libgnome-autoar-9e31292e45032aacf09f183e409a7b3627c5034d.tar.xz
gsoc2013-libgnome-autoar-9e31292e45032aacf09f183e409a7b3627c5034d.tar.zst
gsoc2013-libgnome-autoar-9e31292e45032aacf09f183e409a7b3627c5034d.zip
Fix incorrect data types and wrong file name when the file has no extension
-rw-r--r--gnome-autoar/autoar-common.c5
-rw-r--r--gnome-autoar/autoar-create.c30
-rw-r--r--gnome-autoar/autoar.h2
3 files changed, 31 insertions, 6 deletions
diff --git a/gnome-autoar/autoar-common.c b/gnome-autoar/autoar-common.c
index a56c471..b0f87a2 100644
--- a/gnome-autoar/autoar-common.c
+++ b/gnome-autoar/autoar-common.c
@@ -74,9 +74,10 @@ autoar_common_get_basename_remove_extension (const char *filename)
basename = g_path_get_basename (filename);
dot_location = autoar_common_get_filename_extension (basename);
- *dot_location = '\0';
+ if (dot_location != basename)
+ *dot_location = '\0';
- g_debug ("_g_filename_basename_remove_extension: %s => %s",
+ g_debug ("autoar_common_get_basename_remove_extension: %s => %s",
filename,
basename);
return basename;
diff --git a/gnome-autoar/autoar-create.c b/gnome-autoar/autoar-create.c
index 7846431..d4d21e3 100644
--- a/gnome-autoar/autoar-create.c
+++ b/gnome-autoar/autoar-create.c
@@ -415,8 +415,8 @@ autoar_create_do_write_data (AutoarCreate *arcreate,
arcreate,
autoar_create_signals[PROGRESS],
0,
- (double)(arcreate->priv->completed_size),
- (double)(arcreate->priv->completed_files));
+ arcreate->priv->completed_size,
+ arcreate->priv->completed_files);
if (read_actual > 0) {
written_acc = 0;
do {
@@ -440,6 +440,14 @@ autoar_create_do_write_data (AutoarCreate *arcreate,
archive_error_string (a));
return;
}
+ } else {
+ arcreate->priv->completed_files++;
+ autoar_common_g_signal_emit (in_thread,
+ arcreate,
+ autoar_create_signals[PROGRESS],
+ 0,
+ arcreate->priv->completed_size,
+ arcreate->priv->completed_files);
}
}
@@ -799,7 +807,7 @@ autoar_create_newv (AutoarPref *arpref,
g_return_val_if_fail (output != NULL, NULL);
arcreate = g_object_new (AUTOAR_TYPE_CREATE,
- "source", source,
+ "source", g_variant_new_strv (source, -1),
"output", output,
NULL);
arcreate->priv->arpref = g_object_ref (arpref);
@@ -988,6 +996,22 @@ autoar_create_run (AutoarCreate *arcreate,
file_dest = g_file_get_child (file_output, dest_basename);
}
+ if (!g_file_query_exists (file_output, NULL)) {
+ g_file_make_directory_with_parents (file_output, NULL, &(arcreate->priv->error));
+ if (arcreate->priv->error) {
+ autoar_common_g_signal_emit (in_thread, arcreate,
+ autoar_create_signals[ERROR],
+ 0, arcreate->priv->error);
+ g_object_unref (file_source);
+ g_object_unref (file_output);
+ g_object_unref (file_dest);
+ g_free (source_basename);
+ g_free (source_basename_noext);
+ g_free (dest_basename);
+ return;
+ }
+ }
+
arcreate->priv->dest = g_object_ref (file_dest);
autoar_common_g_signal_emit (in_thread, arcreate,
autoar_create_signals[DECIDE_DEST],
diff --git a/gnome-autoar/autoar.h b/gnome-autoar/autoar.h
index 35b5fb0..7d030bd 100644
--- a/gnome-autoar/autoar.h
+++ b/gnome-autoar/autoar.h
@@ -26,7 +26,7 @@
#ifndef AUTOARCHIVE_H
#define AUTOARHICVE_H
-/* #include <autoarchive/autoar-create.h> */
+#include <gnome-autoar/autoar-create.h>
#include <gnome-autoar/autoar-extract.h>
#include <gnome-autoar/autoar-pref.h>
/* #include <autoarchive/autoar-ui.h> */