From c4c11893343b7987e46d9f287f4b089d2ddbf315 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 2 Sep 2016 17:10:10 +0200 Subject: Treat trailing dot as specified but empty extension Of course now there is no way to specify a name that really has a trailing dot. --- build2/scope.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build2/scope.cxx b/build2/scope.cxx index 9cbeca1..7a16715 100644 --- a/build2/scope.cxx +++ b/build2/scope.cxx @@ -588,7 +588,7 @@ namespace build2 v.clear (); } } - else + else if (!v.empty ()) { // Split the path into its directory part (if any) the name part, // and the extension (if any). We cannot assume the name part is @@ -603,9 +603,12 @@ namespace build2 v = string (v, i + 1, string::npos); } - // Extract the extension. + // Extract the extension. Treat trailing dot as specified but empty + // extension. // - string::size_type j (path::traits::find_extension (v)); + string::size_type j (v.back () != '.' + ? path::traits::find_extension (v) + : v.size () - 1); if (j != string::npos) { -- cgit v1.1