diff --git a/src/file.cpp b/src/file.cpp index 5cd484a51..033b20333 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -941,6 +941,7 @@ namespace libtorrent std::string complete(std::string const& f) { if (is_complete(f)) return f; + if (f == ".") return current_working_directory(); return combine_path(current_working_directory(), f); } diff --git a/test/test_file.cpp b/test/test_file.cpp index c68aad859..09081848a 100644 --- a/test/test_file.cpp +++ b/test/test_file.cpp @@ -153,6 +153,8 @@ int test_main() // test path functions TEST_EQUAL(combine_path("test1/", "test2"), "test1/test2"); + TEST_EQUAL(combine_path("test1", "."), "test1"); + TEST_EQUAL(combine_path(".", "test1"), "test1"); #ifdef TORRENT_WINDOWS TEST_EQUAL(combine_path("test1\\", "test2"), "test1\\test2"); TEST_EQUAL(combine_path("test1", "test2"), "test1\\test2"); @@ -239,6 +241,8 @@ int test_main() TEST_EQUAL(is_complete(""), false); #endif + TEST_EQUAL(complete("."), current_working_directory()); + // test split_string char const* tags[10];