shithub: mc

Download patch

ref: 9543bdfe516ddde6d347bffed6a99c9ec5c0c40b
parent: 161c6c97e8accf066479a9c217c9c6cad4259850
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Dec 12 08:32:05 EST 2017

Only use the last . for the suffix.

	And don't try to be *too* special for .glue.c.

--- a/mbld/util.myr
+++ b/mbld/util.myr
@@ -49,7 +49,7 @@
 	| `std.Some i:	fbase = i
 	| `std.None:	fbase = 0
 	;;
-	match std.strfind(src[fbase:], ".")
+	match std.strrfind(src[fbase:], ".")
 	| `std.None: /* no suffix to trim */
 	| `std.Some i:
 		suff = src[fbase+i:]
@@ -69,12 +69,12 @@
 	var base, platf, suff
 
 	(base, platf, suff) = srcsplit(src)
-	if std.hassuffix(suff, ".myr")
+	if std.hassuffix(src, ".myr")
 		-> std.strcat(base, new)
-	elif std.hassuffix(suff, ".s")
+	elif std.hassuffix(src, ".s")
 		-> std.strcat(base, new)
-	elif std.hassuffix(suff, ".glue.c")
-		-> std.strjoin([base, ".glue", new][:], "")
+	elif std.hassuffix(src, ".glue.c")
+		-> std.strjoin([base, new][:], "")
 	elif std.hassuffix(src, ".o") || std.hassuffix(src, ".6")
 		-> std.sldup(src)
 	else