mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-03 21:30:14 -05:00
Add support for escaping in Windows with the '^' char
This commit is contained in:
parent
ecff017ffe
commit
8fbd8b35ea
5 changed files with 45 additions and 7 deletions
7
HISTORY
7
HISTORY
|
|
@ -1,6 +1,13 @@
|
||||||
SnapRAID HISTORY
|
SnapRAID HISTORY
|
||||||
================
|
================
|
||||||
|
|
||||||
|
10.1 2016/03
|
||||||
|
============
|
||||||
|
* In the Windows version allow to use the escape char '^' to handle
|
||||||
|
file patterns containing real characters matching the globbing '*?[]'
|
||||||
|
ones. In Unix it was already possible to do the same escaping with
|
||||||
|
'\'.
|
||||||
|
|
||||||
10.0 2016/02
|
10.0 2016/02
|
||||||
============
|
============
|
||||||
* Boosts the speed of the 'sync' and 'scrub' commands with a new
|
* Boosts the speed of the 'sync' and 'scrub' commands with a new
|
||||||
|
|
|
||||||
|
|
@ -638,10 +638,17 @@ void pathimport(char* dst, size_t size, const char* src)
|
||||||
pathcpy(dst, size, src);
|
pathcpy(dst, size, src);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* convert all Windows '\' to C '/' */
|
/* convert the Windows dir separator '\' to C '/', */
|
||||||
|
/* and the Windows escaping char '^' to the fnmatch '\' */
|
||||||
while (*dst) {
|
while (*dst) {
|
||||||
if (*dst == '\\')
|
switch (*dst) {
|
||||||
|
case '\\' :
|
||||||
*dst = '/';
|
*dst = '/';
|
||||||
|
break;
|
||||||
|
case '^' :
|
||||||
|
*dst = '\\';
|
||||||
|
break;
|
||||||
|
}
|
||||||
++dst;
|
++dst;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -652,10 +659,16 @@ void pathexport(char* dst, size_t size, const char* src)
|
||||||
pathcpy(dst, size, src);
|
pathcpy(dst, size, src);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* convert all C '/' to Windows '\' */
|
/* invert the import */
|
||||||
while (*dst) {
|
while (*dst) {
|
||||||
if (*dst == '/')
|
switch (*dst) {
|
||||||
|
case '/' :
|
||||||
*dst = '\\';
|
*dst = '\\';
|
||||||
|
break;
|
||||||
|
case '\\' :
|
||||||
|
*dst = '^';
|
||||||
|
break;
|
||||||
|
}
|
||||||
++dst;
|
++dst;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1550,7 +1550,7 @@ There are four different types of patterns:
|
||||||
.TP
|
.TP
|
||||||
.B FILE
|
.B FILE
|
||||||
Selects any file named as FILE. You can use any globbing
|
Selects any file named as FILE. You can use any globbing
|
||||||
character like * and ?.
|
character like * and ?, and char classes like [a\-z].
|
||||||
This pattern is applied only to files and not to directories.
|
This pattern is applied only to files and not to directories.
|
||||||
.TP
|
.TP
|
||||||
.B DIR/
|
.B DIR/
|
||||||
|
|
@ -1578,6 +1578,12 @@ Note that Windows system directories, junctions, mount points, and any
|
||||||
other Windows special directory are treated just as files, meaning that
|
other Windows special directory are treated just as files, meaning that
|
||||||
to exclude them you must use a file rule, and not a directory one.
|
to exclude them you must use a file rule, and not a directory one.
|
||||||
.PP
|
.PP
|
||||||
|
If the file name you want to use really contains a \'*\', \'?\', \'[\',
|
||||||
|
or \']\' char, you have to escape it to avoid to have interpreted as a
|
||||||
|
globbing character. In Unix the escape char is \'\\\' in Windows it\'s \'^\'.
|
||||||
|
Note that when the pattern is on the command line, you have to double the
|
||||||
|
escape character to avoid to have it interpreted by the command shell.
|
||||||
|
.PP
|
||||||
In the configuration file, you can use different strategies to filter
|
In the configuration file, you can use different strategies to filter
|
||||||
the files to process.
|
the files to process.
|
||||||
The simplest one is to use only \[dq]exclude\[dq] rules to remove all the
|
The simplest one is to use only \[dq]exclude\[dq] rules to remove all the
|
||||||
|
|
|
||||||
|
|
@ -1165,7 +1165,7 @@ Pattern
|
||||||
|
|
||||||
=FILE
|
=FILE
|
||||||
Selects any file named as FILE. You can use any globbing
|
Selects any file named as FILE. You can use any globbing
|
||||||
character like * and ?.
|
character like * and ?, and char classes like [a-z].
|
||||||
This pattern is applied only to files and not to directories.
|
This pattern is applied only to files and not to directories.
|
||||||
|
|
||||||
=DIR/
|
=DIR/
|
||||||
|
|
@ -1193,6 +1193,12 @@ Pattern
|
||||||
other Windows special directory are treated just as files, meaning that
|
other Windows special directory are treated just as files, meaning that
|
||||||
to exclude them you must use a file rule, and not a directory one.
|
to exclude them you must use a file rule, and not a directory one.
|
||||||
|
|
||||||
|
If the file name you want to use really contains a '*', '?', '[',
|
||||||
|
or ']' char, you have to escape it to avoid to have interpreted as a
|
||||||
|
globbing character. In Unix the escape char is '\' in Windows it's '^'.
|
||||||
|
Note that when the pattern is on the command line, you have to double the
|
||||||
|
escape character to avoid to have it interpreted by the command shell.
|
||||||
|
|
||||||
In the configuration file, you can use different strategies to filter
|
In the configuration file, you can use different strategies to filter
|
||||||
the files to process.
|
the files to process.
|
||||||
The simplest one is to use only "exclude" rules to remove all the
|
The simplest one is to use only "exclude" rules to remove all the
|
||||||
|
|
|
||||||
|
|
@ -1258,7 +1258,7 @@ There are four different types of patterns:
|
||||||
|
|
||||||
FILE
|
FILE
|
||||||
Selects any file named as FILE. You can use any globbing
|
Selects any file named as FILE. You can use any globbing
|
||||||
character like * and ?.
|
character like * and ?, and char classes like [a-z].
|
||||||
This pattern is applied only to files and not to directories.
|
This pattern is applied only to files and not to directories.
|
||||||
|
|
||||||
DIR/
|
DIR/
|
||||||
|
|
@ -1286,6 +1286,12 @@ Note that Windows system directories, junctions, mount points, and any
|
||||||
other Windows special directory are treated just as files, meaning that
|
other Windows special directory are treated just as files, meaning that
|
||||||
to exclude them you must use a file rule, and not a directory one.
|
to exclude them you must use a file rule, and not a directory one.
|
||||||
|
|
||||||
|
If the file name you want to use really contains a '*', '?', '[',
|
||||||
|
or ']' char, you have to escape it to avoid to have interpreted as a
|
||||||
|
globbing character. In Unix the escape char is '\' in Windows it's '^'.
|
||||||
|
Note that when the pattern is on the command line, you have to double the
|
||||||
|
escape character to avoid to have it interpreted by the command shell.
|
||||||
|
|
||||||
In the configuration file, you can use different strategies to filter
|
In the configuration file, you can use different strategies to filter
|
||||||
the files to process.
|
the files to process.
|
||||||
The simplest one is to use only "exclude" rules to remove all the
|
The simplest one is to use only "exclude" rules to remove all the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue