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