attempted fixes for windows unit tests
This commit is contained in:
parent
e161bf080d
commit
2eab21b0ac
|
@ -261,7 +261,11 @@ int test_main()
|
||||||
bencode(std::back_inserter(buf), torrent);
|
bencode(std::back_inserter(buf), torrent);
|
||||||
torrent_info ti2(&buf[0], buf.size(), ec);
|
torrent_info ti2(&buf[0], buf.size(), ec);
|
||||||
std::cerr << ti2.name() << std::endl;
|
std::cerr << ti2.name() << std::endl;
|
||||||
|
#ifdef TORRENT_WINDOWS
|
||||||
|
TEST_EQUAL(ti2.name(), "ctest1test2test3");
|
||||||
|
#else
|
||||||
TEST_EQUAL(ti2.name(), "test1test2test3");
|
TEST_EQUAL(ti2.name(), "test1test2test3");
|
||||||
|
#endif
|
||||||
|
|
||||||
info["name.utf-8"] = "test2/../test3/.././../../test4";
|
info["name.utf-8"] = "test2/../test3/.././../../test4";
|
||||||
torrent["info"] = info;
|
torrent["info"] = info;
|
||||||
|
|
|
@ -74,7 +74,7 @@ class http_handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||||
ranges = args['ranges'].split('-')
|
ranges = args['ranges'].split('-')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
filename = s.path[1:s.path.find('seed?') + 4]
|
filename = s.path[1:s.path.find('seed?') + 4].replace('/', '\\')
|
||||||
#print 'filename = %s' % filename
|
#print 'filename = %s' % filename
|
||||||
f = open(filename, 'rb')
|
f = open(filename, 'rb')
|
||||||
f.seek(piece * 64 * 1024 + int(ranges[0]))
|
f.seek(piece * 64 * 1024 + int(ranges[0]))
|
||||||
|
@ -93,7 +93,7 @@ class http_handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||||
s.end_headers()
|
s.end_headers()
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
filename = file_path[1:]
|
filename = file_path[1:].replace('/', '\\')
|
||||||
# serve file by invoking default handler
|
# serve file by invoking default handler
|
||||||
f = open(filename, 'rb')
|
f = open(filename, 'rb')
|
||||||
size = int(os.stat(filename).st_size)
|
size = int(os.stat(filename).st_size)
|
||||||
|
|
Loading…
Reference in New Issue