From 5c04eb7d00bb757bd67de2138a805fb2698b4b96 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 1 Jan 2015 21:42:55 +0000 Subject: [PATCH] fix client_test bug introduced by recent patch --- examples/client_test.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/client_test.cpp b/examples/client_test.cpp index 4ff2c2225..d55a15776 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -605,6 +605,18 @@ std::string path_to_url(std::string f) "/-_!.~*()ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" "0123456789"; + // make sure the path is an absolute path +#ifdef TORRENT_WINDOWS + if (f[1] != ':') +#else + if (f[0] != '/') +#endif + { + char cwd[TORRENT_MAX_PATH]; + getcwd(cwd, sizeof(cwd)); + f = path_append(cwd, f); + } + for (int i = 0; i < f.size(); ++i) { #ifdef TORRENT_WINDOWS @@ -619,7 +631,7 @@ std::string path_to_url(std::string f) ret.push_back(hex_chars[f[i] & 0xf]); } } - return f; + return ret; } // monitored_dir is true if this torrent is added because