aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-09-02 17:10:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-09-02 17:10:10 +0200
commitc4c11893343b7987e46d9f287f4b089d2ddbf315 (patch)
tree8bc6542e0ef405175f54b258a844f6311706f6f0
parent70d2386990f3d7d4241f7ab0e5fac3b20c9bbd1f (diff)
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.
-rw-r--r--build2/scope.cxx9
1 files 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)
{