From ddfdd1cb7f377dc8266e51e766644fa8faecc5ef Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Sun, 23 Aug 2020 09:52:01 +0200 Subject: [PATCH] mescc: Do not crash when attemting to link files without extension. * module/mescc/mescc.scm (replace-suffix): Add ELSE clause to IF for base; add IF for old-suffix. --- module/mescc/mescc.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/mescc/mescc.scm b/module/mescc/mescc.scm index 93997fe2..9ef23d7d 100644 --- a/module/mescc/mescc.scm +++ b/module/mescc/mescc.scm @@ -1,5 +1,5 @@ ;;; GNU Mes --- Maxwell Equations of Software -;;; Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Mes. ;;; @@ -242,7 +242,7 @@ ,@(append-map (cut list "-f" <>) M1-files) "-o" ,M1-blood-elf-footer))) (when (and verbose? (> verbose? 1)) - (format (current-error-port) "~a\n" (string-join command))) + (format (current-error-port) "~a\n" (string-join command))) (and (zero? (apply assert-system* command)) (let* ((options (acons 'compile #t options)) ; ugh (options (acons 'output blood-elf-footer options))) @@ -250,8 +250,8 @@ (define (replace-suffix file-name suffix) (let* ((parts (string-split file-name #\.)) - (base (if (pair? (cdr parts)) (drop-right parts 1))) - (old-suffix (last parts)) + (base (if (pair? (cdr parts)) (drop-right parts 1) (list file-name))) + (old-suffix (if (pair? (cdr parts)) (last parts) "")) (program-prefix (cond ((string-prefix? "arm-mes-" old-suffix) ".arm-mes-") ((string-prefix? "x86-mes-" old-suffix) ".x86-mes-") ((string-prefix? "x86_64-mes-" old-suffix) ".x86_64-mes-")