brasero r1386 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1386 - in trunk: . src
- Date: Fri, 17 Oct 2008 08:28:56 +0000 (UTC)
Author: philippr
Date: Fri Oct 17 08:28:56 2008
New Revision: 1386
URL: http://svn.gnome.org/viewvc/brasero?rev=1386&view=rev
Log:
Improved handling of symlinks pointing to an image
Fix #551051 â Brasero shows absurdly large %-done when burning a symlink-to-ISO (divide by 0 error)
since we were using the size of the symlink file not the size of the target
* src/brasero-project-manager.c (brasero_project_manager_open_uri):
* src/burn-image-format.c (brasero_image_format_get_FILE_info),
(brasero_image_format_get_cue_size),
(brasero_image_format_get_iso_size),
(brasero_image_format_get_clone_size):
* src/burn-medium.c (brasero_medium_track_set_leadout):
Modified:
trunk/ChangeLog
trunk/src/brasero-project-manager.c
trunk/src/burn-image-format.c
trunk/src/burn-medium.c
Modified: trunk/src/brasero-project-manager.c
==============================================================================
--- trunk/src/brasero-project-manager.c (original)
+++ trunk/src/brasero-project-manager.c Fri Oct 17 08:28:56 2008
@@ -924,13 +924,59 @@
BraseroProjectType type;
/* FIXME: make that asynchronous */
+ /* NOTE: don't follow symlink because we want to identify them */
file = g_file_new_for_commandline_arg (uri_arg);
info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- G_FILE_QUERY_INFO_NONE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK ","
+ G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL,
NULL);
+ /* if that's a symlink, redo it on its target to get the real mime type
+ * that usually also depends on the extension of the target:
+ * ex: an iso file with the extension .iso will be seen as octet-stream
+ * if the symlink hasn't got any extention at all */
+ while (g_file_info_get_is_symlink (info)) {
+ const gchar *target;
+ GFileInfo *tmp_info;
+ GFile *tmp_file;
+ GError *error = NULL;
+
+ target = g_file_info_get_symlink_target (info);
+ if (!g_path_is_absolute (target)) {
+ gchar *parent;
+ gchar *tmp;
+
+ tmp = g_file_get_path (file);
+ parent = g_path_get_dirname (tmp);
+ g_free (tmp);
+
+ target = g_build_filename (parent, target, NULL);
+ g_free (parent);
+ }
+
+ tmp_file = g_file_new_for_commandline_arg (target);
+ tmp_info = g_file_query_info (tmp_file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK ","
+ G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ NULL,
+ &error);
+ if (!tmp_info) {
+ g_object_unref (tmp_file);
+ break;
+ }
+
+ g_object_unref (info);
+ g_object_unref (file);
+
+ info = tmp_info;
+ file = tmp_file;
+ }
+
uri = g_file_get_uri (file);
if (g_file_query_exists (file, NULL)) {
const gchar *mime;
@@ -939,6 +985,7 @@
type = brasero_project_manager_open_by_mime (manager, uri, mime);
}
else {
+ /* FIXME: we may want to ask the user if he wants to remove it */
window = gtk_widget_get_toplevel (GTK_WIDGET (manager));
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
Modified: trunk/src/burn-image-format.c
==============================================================================
--- trunk/src/burn-image-format.c (original)
+++ trunk/src/burn-image-format.c Fri Oct 17 08:28:56 2008
@@ -380,8 +380,9 @@
g_free (tmp);
}
- /* if size is skipped then g_lstat () the file */
- res = g_lstat (path, &buffer);
+ /* if size is skipped then g_stat () the file */
+ /* NOTE: follow symlink if any */
+ res = g_stat (path, &buffer);
g_free (path);
if (res == -1) {
@@ -580,7 +581,8 @@
g_free (tmp);
}
- res = g_lstat (file_path, &buffer);
+ /* NOTE: follow symlink if any */
+ res = g_stat (path, &buffer);
if (res == -1) {
g_set_error (error,
BRASERO_BURN_ERR,
@@ -735,7 +737,8 @@
* since it'll be local and stat() will work.
* if local-track is not enabled we can't use non-local images anyway so
* there is no need to have a function set_size */
- res = g_lstat (path, &buffer);
+ /* NOTE: follow symlink if any */
+ res = g_stat (path, &buffer);
if (res == -1) {
g_set_error (error,
BRASERO_BURN_ERR,
@@ -776,7 +779,8 @@
* since it'll be local and stat() will work.
* if local-track is not enabled we can't use non-local images anyway so
* there is no need to have a function set_size */
- res = g_lstat (path, &buffer);
+ /* NOTE: follow symlink if any */
+ res = g_stat (path, &buffer);
if (res == -1) {
g_set_error (error,
BRASERO_BURN_ERR,
Modified: trunk/src/burn-medium.c
==============================================================================
--- trunk/src/burn-medium.c (original)
+++ trunk/src/burn-medium.c Fri Oct 17 08:28:56 2008
@@ -1543,7 +1543,7 @@
else {
BRASERO_BURN_LOG ("MODE SENSE failed");
- /* This isn't necessarily a problem */
+ /* This isn't necessarily a problem we better try the rest */
// return BRASERO_BURN_ERR;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]