1;; The `setup' tool loads this module with bytecode files disabled,
2;; so minimize its dependencies
3
4(module command-name '#%kernel
5  (#%require raco/command-name '#%utils)
6  (#%provide get-names)
7
8  (define-values (get-names)
9    (lambda ()
10      (let-values ([(p) (find-system-path 'run-file)])
11        (let-values ([(p) (if (eq? (system-type) 'windows)
12                              (path-replace-extension p #"")
13                              p)])
14          (let-values ([(base name dir?) (split-path p)])
15            (if (current-command-name)
16                (values (format "~a ~a" name (current-command-name))
17                        (program+command-name)
18                        #t)
19                ;; Hack for bootstrapping, if the program name is "raco",
20                ;; then claim to be the "setup" command:
21                ;; if the program name is "racket", assume that there's a "racket -l setup"
22                ;; going on in there and also claim to be the "raco setup" command
23                (if (if (regexp-match? #rx"^raco(?i:|3m|cgc|cs|bc)$" (path->string name))
24                        #t
25                        (regexp-match? #rx"^racket(?i:|3m|cgc|cs|bc)$" (path->string name)))
26                    (values "raco setup"
27                            (string-append (regexp-replace*
28                                            #rx"racket$"
29                                            (format "~a" p)
30                                            "raco")
31                                           " setup")
32                            #t)
33                    (values (path->string name) p #f)))))))))
34
35