-unix_extract_directory(struct wim_dentry *dentry, const tchar *output_path,
- int extract_flags)
-{
- int ret;
- struct stat stbuf;
-
- ret = tstat(output_path, &stbuf);
- if (ret == 0) {
- if (S_ISDIR(stbuf.st_mode)) {
- goto dir_exists;
- } else {
- ERROR("`%"TS"' is not a directory", output_path);
- return WIMLIB_ERR_MKDIR;
- }
- } else {
- if (errno != ENOENT) {
- ERROR_WITH_ERRNO("Failed to stat `%"TS"'", output_path);
- return WIMLIB_ERR_STAT;
- }
- }
-
- if (tmkdir(output_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH))
- {
- ERROR_WITH_ERRNO("Cannot create directory `%"TS"'", output_path);
- return WIMLIB_ERR_MKDIR;
- }
-dir_exists:
- ret = 0;
-#ifndef __WIN32__
- if (extract_flags & WIMLIB_EXTRACT_FLAG_UNIX_DATA) {
- struct wimlib_unix_data unix_data;
- ret = inode_get_unix_data(dentry->d_inode, &unix_data, NULL);
- if (ret > 0)
- ;
- else if (ret < 0)
- ret = 0;
- else
- ret = dir_apply_unix_data(output_path, &unix_data,
- extract_flags);
- }
-#endif
- return ret;
-}
-
-int
-unix_do_apply_dentry(const char *output_path, size_t output_path_len,
- struct wim_dentry *dentry, struct apply_args *args)
-{
- const struct wim_inode *inode = dentry->d_inode;
-
- if (inode_is_symlink(inode))
- return unix_extract_symlink(dentry, args, output_path);
- else if (inode_is_directory(inode))
- return unix_extract_directory(dentry, output_path, args->extract_flags);
- else
- return unix_extract_regular_file(dentry, args, output_path);
-}
-
-int
-unix_do_apply_dentry_timestamps(const char *output_path,
- size_t output_path_len,
- struct wim_dentry *dentry,
- struct apply_args *args)