Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From-template doesn't support directories with spaces in the path on Windows 10. #25

Open
Thelas opened this issue Dec 30, 2021 · 4 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Thelas
Copy link

Thelas commented Dec 30, 2021

When attempting to use the Qi tutorial, I did raco new qi-tutorial in a subdirectory of my home folder. Unfortunately, my Windows username has a space in it. Accordingly, I get the message 'C:\Users\Byron' is not recognized as an internal or external command, operable program or batch file., probably because the path isn't quoted in whatever script is being run.
I also tried raco new rosette in a different subfolder to make sure it wasn't an issue with the qi tutorial specifically, which also failed in the same way.
Specifying the path explicitly (whether as . or the quoted full absolute path) also encounters the same error.

@spdegabrielle
Copy link
Member

@countvajhula
Copy link

Can also use build-path instead of string-append to construct a platform-specific path. The example in the docs even includes a path with a space.

@spdegabrielle
Copy link
Member

(system (string-append (path->string windows-script) " " protocol " " repo-name " " dir-name))]))

is this resolved?

I don't have a windows machine to test on right now

(define [clone-repo repo-name dir-name]
  (define protocol (if (ssh?) "[email protected]:" "https://github.com/"))
  (case (system-type 'os)
    [(unix)
     (system (string-append "bash " (path->string linux-script) " " protocol " " repo-name " " dir-name))]
    [(macosx)
     (system (string-append "bash " (path->string macosx-script) " " protocol " " repo-name " " dir-name))]
    [(windows)
     (system (string-append "\"" (path->string windows-script)"\"" " " protocol " " repo-name " " dir-name))]))

if not resolved

If (define-runtime-path windows-script "raco-new.bat") is run under windows I believe it should create a string with windows path conventions like build-path

or do we explicitly need to include quotation marks before and after the path?

I've made a test file that could be used on windows:

#lang Racket
;; test to see if path->string adds quotation marks under windows
(require  racket/runtime-path)
(define-runtime-path windows-script "raco-new.bat")
(define repo-name  "blahrepo")
(define  dir-name "dirblah")
(define protocol "https://github.com/")
;; if this displays ""raco-new.bat"" I'm assumign we don't need "\""
(displayln (string-append "\"" (path->string windows-script)"\"" " " protocol " " repo-name " " dir-name))

system*

Would this be resolved if we use (system* windows-script) protocol repo-name dir-name)
https://docs.racket-lang.org/reference/subprocess.html#%28def._%28%28lib._racket%2Fsystem..rkt%29._system%2A%29%29
e.g.

(define [clone-repo repo-name dir-name]
  (define protocol (if (ssh?) "[email protected]:" "https://github.com/"))
  (case (system-type 'os)
    [(unix)
     (system* linux-script protocol repo-name dir-name)]
    [(macosx)
     (system* macosx-script protocol repo-name dir-name)]
    [(windows)
     (system* windows-script protocol repo-name dir-name)]))

I've just jotted this down, I'll test on macOS this evening

@nixin72 @priime0 appreciate your advice

is anyone able to test on windows ?

@spdegabrielle spdegabrielle added bug Something isn't working help wanted Extra attention is needed labels Feb 2, 2025
@nixin72
Copy link
Member

nixin72 commented Feb 2, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants