Implement function to recursively add a dir to an iso tree.
This commit also to the following changes: - create_node() on builder never frees the IsoFileSource, it is responsability of the caller to free it. - Recursive addition options added to IsoImage (not exposed to public API yet) - create_node() takes care about follow_symlinks - Added little demo program to test it.
This commit is contained in:
64
src/image.h
64
src/image.h
@@ -21,6 +21,8 @@
|
||||
* (Usefull, for example, in Multiple-Document-Interface GUI apps.
|
||||
* [The stuff we have in init belongs really to image!]
|
||||
*/
|
||||
|
||||
typedef struct Iso_Image_Rec_Opts IsoImageRecOpts;
|
||||
|
||||
struct Iso_Image {
|
||||
|
||||
@@ -51,6 +53,68 @@ struct Iso_Image {
|
||||
* Default builder to use when adding files to the image tree.
|
||||
*/
|
||||
IsoNodeBuilder *builder;
|
||||
|
||||
/**
|
||||
* Options for recursive directory addition
|
||||
*/
|
||||
IsoImageRecOpts *recOpts;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for recursive directory addition
|
||||
*/
|
||||
struct Iso_Image_Rec_Opts {
|
||||
|
||||
/**
|
||||
* Whether to follow symlinks or just add them as symlinks
|
||||
*/
|
||||
unsigned int follow_symlinks;
|
||||
|
||||
/**
|
||||
* Whether to skip hidden files
|
||||
*/
|
||||
unsigned int ignore_hidden;
|
||||
|
||||
/**
|
||||
* Whether to stop on an error. Some errors, such as memory errors,
|
||||
* always cause a stop
|
||||
*/
|
||||
unsigned int stop_on_error;
|
||||
|
||||
/**
|
||||
* Files to exclude
|
||||
* TODO add wildcard support
|
||||
*/
|
||||
char** excludes;
|
||||
|
||||
/**
|
||||
* if the dir already contains a node with the same name, whether to
|
||||
* replace or not the old node with the new.
|
||||
* - 0 not replace
|
||||
* - 1 replace
|
||||
* TODO #00006 define more values
|
||||
* to replace only if both are the same kind of file
|
||||
* if both are dirs, add contents (and what to do with conflicts?)
|
||||
*/
|
||||
int replace;
|
||||
|
||||
/**
|
||||
* When this is not NULL, it is a pointer to a function that will
|
||||
* be called just before a file will be added, or when an error occurs.
|
||||
* You can overwrite some of the above options by returning suitable
|
||||
* values.
|
||||
*
|
||||
* @param action
|
||||
* 1 file will be added
|
||||
* 2 file will be skipped
|
||||
* < 0 error adding file (return 3 to stop, 1 to continue)
|
||||
* @param flag
|
||||
* 0 no problem
|
||||
* 1 file with same name already exists
|
||||
* @return
|
||||
* 1 add/continue, 2 skip, 3 stop
|
||||
*/
|
||||
int (*report)(IsoFileSource *src, int action, int flag);
|
||||
};
|
||||
|
||||
#endif /*LIBISO_IMAGE_H_*/
|
||||
|
Reference in New Issue
Block a user