Removed stop_on_error, now replaced by iso_set_abort_severity().

This commit is contained in:
Vreixo Formoso 2008-01-23 20:11:52 +01:00
parent d92f8f68d2
commit c272228590
8 changed files with 13 additions and 46 deletions

View File

@ -144,7 +144,6 @@ int main(int argc, char **argv)
iso_tree_set_follow_symlinks(image, 0); iso_tree_set_follow_symlinks(image, 0);
iso_tree_set_ignore_hidden(image, 0); iso_tree_set_ignore_hidden(image, 0);
iso_tree_set_ignore_special(image, 0); iso_tree_set_ignore_special(image, 0);
iso_tree_set_stop_on_error(image, 0);
iso_set_abort_severity("SORRY"); iso_set_abort_severity("SORRY");
result = iso_tree_add_dir_rec(image, iso_image_get_root(image), argv[optind]); result = iso_tree_add_dir_rec(image, iso_image_get_root(image), argv[optind]);

View File

@ -90,7 +90,6 @@ int main(int argc, char **argv)
} }
iso_tree_set_follow_symlinks(image, 0); iso_tree_set_follow_symlinks(image, 0);
iso_tree_set_ignore_hidden(image, 0); iso_tree_set_ignore_hidden(image, 0);
iso_tree_set_stop_on_error(image, 0);
if (!burn_initialize()) { if (!burn_initialize()) {
err(1, "Can't init libburn"); err(1, "Can't init libburn");

View File

@ -97,7 +97,6 @@ int main(int argc, char **argv)
} }
iso_tree_set_follow_symlinks(image, 0); iso_tree_set_follow_symlinks(image, 0);
iso_tree_set_ignore_hidden(image, 0); iso_tree_set_ignore_hidden(image, 0);
iso_tree_set_stop_on_error(image, 0);
/* import previous image */ /* import previous image */
result = iso_image_import(image, src, &ropts, NULL); result = iso_image_import(image, src, &ropts, NULL);

View File

@ -97,7 +97,6 @@ int main(int argc, char **argv)
} }
iso_tree_set_follow_symlinks(image, 0); iso_tree_set_follow_symlinks(image, 0);
iso_tree_set_ignore_hidden(image, 0); iso_tree_set_ignore_hidden(image, 0);
iso_tree_set_stop_on_error(image, 0);
/* import previous image */ /* import previous image */
ropts.block = atoi(argv[1]); ropts.block = atoi(argv[1]);

View File

@ -40,12 +40,6 @@ struct Iso_Image_Rec_Opts
*/ */
unsigned int ignore_hidden : 1; unsigned int ignore_hidden : 1;
/**
* Whether to stop on an error. Some errors, such as memory errors,
* always cause a stop
*/
unsigned int stop_on_error : 1;
/** /**
* Flags that determine what special files should be ignore. It is a * Flags that determine what special files should be ignore. It is a
* bitmask: * bitmask:

View File

@ -252,6 +252,8 @@ int libiso_msgs__text_to_sev(char *severity_name, int *severity,
*severity= LIBISO_MSGS_SEV_ABORT; *severity= LIBISO_MSGS_SEV_ABORT;
else if(strncmp(severity_name,"FATAL",5)==0) else if(strncmp(severity_name,"FATAL",5)==0)
*severity= LIBISO_MSGS_SEV_FATAL; *severity= LIBISO_MSGS_SEV_FATAL;
else if(strncmp(severity_name,"ERROR",5)==0)
*severity= LIBISO_MSGS_SEV_ERROR;
else if(strncmp(severity_name,"SORRY",5)==0) else if(strncmp(severity_name,"SORRY",5)==0)
*severity= LIBISO_MSGS_SEV_SORRY; *severity= LIBISO_MSGS_SEV_SORRY;
else if(strncmp(severity_name,"WARNING",7)==0) else if(strncmp(severity_name,"WARNING",7)==0)
@ -289,6 +291,8 @@ int libiso_msgs__sev_to_text(int severity, char **severity_name,
*severity_name= "ABORT"; *severity_name= "ABORT";
else if(severity>=LIBISO_MSGS_SEV_FATAL) else if(severity>=LIBISO_MSGS_SEV_FATAL)
*severity_name= "FATAL"; *severity_name= "FATAL";
else if(severity>=LIBISO_MSGS_SEV_ERROR)
*severity_name= "ERROR";
else if(severity>=LIBISO_MSGS_SEV_SORRY) else if(severity>=LIBISO_MSGS_SEV_SORRY)
*severity_name= "SORRY"; *severity_name= "SORRY";
else if(severity>=LIBISO_MSGS_SEV_WARNING) else if(severity>=LIBISO_MSGS_SEV_WARNING)

View File

@ -1540,19 +1540,6 @@ void iso_tree_set_ignore_special(IsoImage *image, int skip);
*/ */
int iso_tree_get_ignore_special(IsoImage *image); int iso_tree_get_ignore_special(IsoImage *image);
/**
* Set whether to stop or not when an error happens when adding recursively a
* directory to the iso tree. Default value is to skip file and continue.
*/
void iso_tree_set_stop_on_error(IsoImage *image, int stop);
/**
* Get current setting for stop_on_error.
*
* @see iso_tree_set_stop_on_error
*/
int iso_tree_get_stop_on_error(IsoImage *image);
/** /**
* Add a new node to the image tree, from an existing file. * Add a new node to the image tree, from an existing file.
* *

View File

@ -362,25 +362,6 @@ int iso_tree_get_ignore_special(IsoImage *image)
return image->recOpts.ignore_special; return image->recOpts.ignore_special;
} }
/**
* Set whether to stop or not when an error happens when adding recursively a
* directory to the iso tree. Default value is to skip file and continue.
*/
void iso_tree_set_stop_on_error(IsoImage *image, int stop)
{
image->recOpts.stop_on_error = stop ? 1 : 0;
}
/**
* Get current setting for stop_on_error.
*
* @see iso_tree_set_stop_on_error
*/
int iso_tree_get_stop_on_error(IsoImage *image)
{
return image->recOpts.stop_on_error;
}
static static
int iso_tree_add_node_builder(IsoImage *image, IsoDir *parent, int iso_tree_add_node_builder(IsoImage *image, IsoDir *parent,
IsoFileSource *src, IsoNodeBuilder *builder, IsoFileSource *src, IsoNodeBuilder *builder,
@ -507,7 +488,9 @@ int iso_add_dir_src_rec(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
ret = iso_file_source_open(dir); ret = iso_file_source_open(dir);
if (ret < 0) { if (ret < 0) {
char *path = iso_file_source_get_path(dir); char *path = iso_file_source_get_path(dir);
iso_msg_debug(image->id, "Can't open dir %s", path); /* instead of the probable error, we throw a warning */
ret = iso_msg_submit(image->id, ISO_FILE_CANT_ADD, ret,
"Can't open dir %s", path);
free(path); free(path);
return ret; return ret;
} }
@ -600,10 +583,13 @@ dir_rec_continue:;
free(path); free(path);
iso_file_source_unref(file); iso_file_source_unref(file);
/* TODO check for error severity to decide what to do */ /* check for error severity to decide what to do */
if (ret == ISO_CANCELED || (ret < 0 && image->recOpts.stop_on_error)) { if (ret < 0) {
ret = iso_msg_submit(image->id, ret, 0, NULL);
if (ret < 0) {
break; break;
} }
}
} /* while */ } /* while */
iso_file_source_close(dir); iso_file_source_close(dir);