Doesn't exclude anymore system files in Windows.

This commit is contained in:
Andrea Mazzoleni 2013-04-28 17:33:48 +02:00
parent e1e8ec9cfd
commit db330b9d0b
2 changed files with 35 additions and 19 deletions

View file

@ -3,7 +3,9 @@ SnapRAID HISTORY
3.1 2013/4
==========
* Diret use of Windows API for disk access to improve error reporting.
* Direct use of Windows API for disk access to improve error reporting.
* In Windows don't exclude anymore system files. Only system directories are
excluded.
3.0 2013/3
==========

50
mingw.c
View file

@ -312,13 +312,10 @@ static void windows_info2stat(const BY_HANDLE_FILE_INFORMATION* info, const FILE
if ((info->dwFileAttributes & FILE_ATTRIBUTE_DEVICE) != 0) {
st->st_mode = S_IFBLK;
st->st_desc = "device";
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) != 0) { /* System */
st->st_mode = S_IFCHR;
st->st_desc = "system";
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) != 0) { /* Offline */
st->st_mode = S_IFCHR;
st->st_desc = "offline";
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0) { /* Files going to be deleted on close */
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0) { /* Temporary */
st->st_mode = S_IFCHR;
st->st_desc = "temporary";
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { /* Reparse point */
@ -356,12 +353,22 @@ static void windows_info2stat(const BY_HANDLE_FILE_INFORMATION* info, const FILE
st->st_desc = "reparse-point";
break;
}
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
st->st_mode = S_IFDIR;
st->st_desc = "directory";
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) != 0) { /* System */
if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
st->st_mode = S_IFCHR;
st->st_desc = "system-directory";
} else {
st->st_mode = S_IFREG;
st->st_desc = "system-file";
}
} else {
st->st_mode = S_IFREG;
st->st_desc = "regular";
if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
st->st_mode = S_IFDIR;
st->st_desc = "directory";
} else {
st->st_mode = S_IFREG;
st->st_desc = "regular";
}
}
/* Store the HIDDEN attribute in a separate field */
@ -405,13 +412,10 @@ static void windows_finddata2stat(const WIN32_FIND_DATAW* info, struct windows_s
if ((info->dwFileAttributes & FILE_ATTRIBUTE_DEVICE) != 0) {
st->st_mode = S_IFBLK;
st->st_desc = "device";
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) != 0) { /* System */
st->st_mode = S_IFCHR;
st->st_desc = "system";
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) != 0) { /* Offline */
st->st_mode = S_IFCHR;
st->st_desc = "offline";
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0) { /* Files going to be deleted on close */
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0) { /* Temporary */
st->st_mode = S_IFCHR;
st->st_desc = "temporary";
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { /* Reparse point */
@ -449,12 +453,22 @@ static void windows_finddata2stat(const WIN32_FIND_DATAW* info, struct windows_s
st->st_desc = "reparse-point";
break;
}
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
st->st_mode = S_IFDIR;
st->st_desc = "directory";
} else if ((info->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) != 0) { /* System */
if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
st->st_mode = S_IFCHR;
st->st_desc = "system-directory";
} else {
st->st_mode = S_IFREG;
st->st_desc = "system-file";
}
} else {
st->st_mode = S_IFREG;
st->st_desc = "regular";
if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
st->st_mode = S_IFDIR;
st->st_desc = "directory";
} else {
st->st_mode = S_IFREG;
st->st_desc = "regular";
}
}
/* Store the HIDDEN attribute in a separate field */