From 36c1510273e71b75f357580ede3046c06c9e7c77 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Thu, 22 Nov 2018 21:20:18 +0900 Subject: [PATCH] Fixed relative locate_root path normalization --- common/src/process_jam_log.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/src/process_jam_log.cpp b/common/src/process_jam_log.cpp index 8726f10..55c5bd0 100644 --- a/common/src/process_jam_log.cpp +++ b/common/src/process_jam_log.cpp @@ -712,7 +712,14 @@ int process_jam_log( const std::vector & args ) } else if ( !locate_root.has_root_path() ) { - locate_root = ( fs::initial_path() / locate_root ).normalize(); + // path.normalize() encodes to dot terinated path if trailing non-root slash is present. + // path{"/foo/"}.normalize() //=> /foo/. + // In this case, stringized path is 2 chars longer than non dot terminated path, and it + // may fail to construct correct path in target_directory(). To avoid this behaviour + // make file path form once, and get normalized parent path. + // + // https://www.boost.org/libs/filesystem/doc/reference.html#path-iterators + locate_root = ( fs::initial_path() / locate_root / "entry" ).normalize().parent_path(); } if ( input == 0 )