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.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-08-23 09:52:01 +02:00
parent ae14a08aad
commit ddfdd1cb7f
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -1,5 +1,5 @@
;;; GNU Mes --- Maxwell Equations of Software
;;; Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Mes.
;;;
@ -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-")