fixed bug in is_complete for windows

This commit is contained in:
Arvid Norberg 2010-03-21 17:40:15 +00:00
parent 1d0e2c0a37
commit 8fa2f26217
2 changed files with 2 additions and 1 deletions

View File

@ -575,7 +575,7 @@ namespace libtorrent
int i = 0; int i = 0;
// match the xx:\ or xx:/ form // match the xx:\ or xx:/ form
while (f[i] && is_alpha(f[i])) ++i; while (f[i] && is_alpha(f[i])) ++i;
if (i < int(f.size()-2) && f[i] == ':' && (f[i+1] == '\\' || f[i+1] == '/')) if (i < int(f.size()-1) && f[i] == ':' && (f[i+1] == '\\' || f[i+1] == '/'))
return true; return true;
// match the \\ form // match the \\ form

View File

@ -543,6 +543,7 @@ int test_main()
#endif #endif
#ifdef TORRENT_WINDOWS #ifdef TORRENT_WINDOWS
TEST_EQUAL(is_complete("c:\\"), true);
TEST_EQUAL(is_complete("c:\\foo\\bar"), true); TEST_EQUAL(is_complete("c:\\foo\\bar"), true);
TEST_EQUAL(is_complete("\\\\foo\\bar"), true); TEST_EQUAL(is_complete("\\\\foo\\bar"), true);
TEST_EQUAL(is_complete("foo/bar"), false); TEST_EQUAL(is_complete("foo/bar"), false);