#include <string.h>
#include <errno.h>
#include <fnmatch.h>
+#include <ctype.h>
#include <unistd.h>
/** Private flag: Used to mark that we currently adding the root directory of
"\\$ntfs.log\n"
"\\hiberfil.sys\n"
"\\pagefile.sys\n"
-"\"\\System Volume Information\"\n"
+"\\System Volume Information\n"
"\\RECYCLER\n"
"\\Windows\\CSC\n"
"\n"
if (*pp == '\\')
*pp = '/';
+ /* Remove drive letter */
+ if (eol - p > 2 && isalpha(*p) && *(p + 1) == ':')
+ p += 2;
+
if (strcmp(p, "[ExclusionList]") == 0)
type = EXCLUSION_LIST;
else if (strcmp(p, "[ExclusionException]") == 0)
const char *pat = list->pats[i];
const char *string;
if (pat[0] == '/')
+ /* Absolute path from root of capture */
string = path;
- else
- string = path_basename;
- if (fnmatch(pat, string, FNM_PATHNAME) == 0) {
+ else {
+ if (strchr(pat, '/'))
+ /* Relative path from root of capture */
+ string = path + 1;
+ else
+ /* A file name pattern */
+ string = path_basename;
+ }
+ if (fnmatch(pat, string, FNM_PATHNAME
+ #ifdef FNM_CASEFOLD
+ | FNM_CASEFOLD
+ #endif
+ ) == 0)
+ {
DEBUG("`%s' matches the pattern \"%s\"",
string, pat);
return true;
int do_add_image(WIMStruct *w, const char *dir, const char *name,
- const char *description, const char *flags_element,
const char *config_str, size_t config_len,
int flags,
int (*capture_tree)(struct dentry **, const char *,
if (flags & WIMLIB_ADD_IMAGE_FLAG_BOOT)
wimlib_set_boot_idx(w, w->hdr.image_count);
- ret = xml_add_image(w, root_dentry, name, description, flags_element);
+ ret = xml_add_image(w, root_dentry, name);
if (ret != 0)
goto out_destroy_imd;
* Adds an image to a WIM file from a directory tree on disk.
*/
WIMLIBAPI int wimlib_add_image(WIMStruct *w, const char *dir,
- const char *name, const char *description,
- const char *flags_element,
- const char *config_str,
+ const char *name, const char *config_str,
size_t config_len, int flags)
{
- return do_add_image(w, dir, name, description, flags_element,
- config_str, config_len, flags,
+ return do_add_image(w, dir, name, config_str, config_len, flags,
build_dentry_tree, NULL);
}