attempted fixes for windows unit tests

This commit is contained in:
Arvid Norberg 2015-01-09 00:41:19 +00:00
parent e161bf080d
commit 2eab21b0ac
2 changed files with 6 additions and 2 deletions

View File

@ -261,7 +261,11 @@ int test_main()
bencode(std::back_inserter(buf), torrent);
torrent_info ti2(&buf[0], buf.size(), ec);
std::cerr << ti2.name() << std::endl;
#ifdef TORRENT_WINDOWS
TEST_EQUAL(ti2.name(), "ctest1test2test3");
#else
TEST_EQUAL(ti2.name(), "test1test2test3");
#endif
info["name.utf-8"] = "test2/../test3/.././../../test4";
torrent["info"] = info;

View File

@ -74,7 +74,7 @@ class http_handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
ranges = args['ranges'].split('-')
try:
filename = s.path[1:s.path.find('seed?') + 4]
filename = s.path[1:s.path.find('seed?') + 4].replace('/', '\\')
#print 'filename = %s' % filename
f = open(filename, 'rb')
f.seek(piece * 64 * 1024 + int(ranges[0]))
@ -93,7 +93,7 @@ class http_handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
s.end_headers()
else:
try:
filename = file_path[1:]
filename = file_path[1:].replace('/', '\\')
# serve file by invoking default handler
f = open(filename, 'rb')
size = int(os.stat(filename).st_size)