patch modify bug incorrectly identifying source file to be replaced

This commit is contained in:
sorrel 2024-04-05 13:45:32 -04:00
parent edbb9dc3d4
commit b3940516d9

View file

@ -1,7 +1,7 @@
#lang cli
(require (only-in racket/date current-date date->string date-display-format)
(only-in racket/string string-join non-empty-string?)
(only-in racket/string string-join string-split non-empty-string?)
(only-in racket/list first second third fourth fifth last take drop flatten add-between)
(only-in racket/format ~a)
(only-in racket/exn exn->string)
@ -79,15 +79,15 @@
;; locate existing post in source
;; (. -> . input-port? output-port?)
(define (get-source-ports)
(let ([file-handle (path-add-extension
(if (equal? r-type "root")
(let*
([file-id (last (string-split n-in "/"))]
[file-handle (if (equal? r-type "root")
(if x-test
(build-path "publish-test" "source" l-head)
(build-path "source" l-head))
(build-path "publish-test" "source" file-id)
(build-path "source" file-id))
(if x-test
(build-path "publish-test" "source" r-type l-head)
(build-path "source" r-type l-head)))
#".scm")])
(build-path "publish-test" "source" r-type file-id)
(build-path "source" r-type file-id)))])
(values
(open-input-file file-handle)
(open-output-file file-handle #:exists 'update))))