mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Automatically exclude the snapshot .snapraid directory and content files
This commit is contained in:
parent
37ff42a1c2
commit
ea470341aa
10 changed files with 111 additions and 22 deletions
|
|
@ -1193,20 +1193,61 @@ void pathup(char* dst)
|
|||
int pathcmp(const char* a, const char* b)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
char ai[PATH_MAX];
|
||||
char bi[PATH_MAX];
|
||||
while (1) {
|
||||
char ca = *a++;
|
||||
char cb = *b++;
|
||||
|
||||
/* import to convert \ to / */
|
||||
pathimport(ai, sizeof(ai), a);
|
||||
pathimport(bi, sizeof(bi), b);
|
||||
if (ca == '/')
|
||||
ca = '\\';
|
||||
|
||||
/* case insensitive compare in Windows */
|
||||
return stricmp(ai, bi);
|
||||
if (cb == '/')
|
||||
cb = '\\';
|
||||
|
||||
int la = tolower((unsigned char)ca);
|
||||
int lb = tolower((unsigned char)cb);
|
||||
|
||||
if (la != lb)
|
||||
return la - lb;
|
||||
|
||||
if (la == 0)
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
return strcmp(a, b);
|
||||
#endif
|
||||
}
|
||||
|
||||
int pathncmp(const char* a, const char* b, size_t n)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
while (n > 0) {
|
||||
char ca = *a++;
|
||||
char cb = *b++;
|
||||
|
||||
if (ca == '/')
|
||||
ca = '\\';
|
||||
|
||||
if (cb == '/')
|
||||
cb = '\\';
|
||||
|
||||
int la = tolower((unsigned char)ca);
|
||||
int lb = tolower((unsigned char)cb);
|
||||
|
||||
if (la != lb)
|
||||
return la - lb;
|
||||
|
||||
if (la == '\0')
|
||||
return 0;
|
||||
|
||||
--n;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return strncmp(a, b, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
int path_is_root_of(const char* root, const char* path)
|
||||
{
|
||||
while (*root && *path) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue