@@ -70,13 +70,24 @@ function download(url, path) {
7070
7171// execute the binary executable to generate the certificates
7272function mkcert ( appDataPath , exe , domain ) {
73- const logPath = path . join ( appDataPath , "mkcert.log" )
74- const errPath = path . join ( appDataPath , "mkcert.err" )
75- // escape spaces in appDataPath (Mac OS)
76- appDataPath = appDataPath . replace ( " " , "\\ " )
77- const exePath = path . join ( appDataPath , exe )
78- const crtPath = path . join ( appDataPath , domain + ".crt" )
79- const keyPath = path . join ( appDataPath , domain + ".key" )
73+ // fix problems with spaces
74+ /* istanbul ignore next: platform dependent */
75+ const ensureValidPath = function ( path ) {
76+ // use apex on Windows
77+ if ( process . platform === "win32" )
78+ return "\"" + path + "\""
79+ // escape spaces in Mac OS
80+ if ( process . platform === "darwin" )
81+ return path . replace ( / / g, "\\ " )
82+ return path
83+ }
84+
85+ const logPath = ensureValidPath ( path . join ( appDataPath , "mkcert.log" ) )
86+ const errPath = ensureValidPath ( path . join ( appDataPath , "mkcert.err" ) )
87+ const exePath = ensureValidPath ( path . join ( appDataPath , exe ) )
88+ const crtPath = ensureValidPath ( path . join ( appDataPath , domain + ".crt" ) )
89+ const keyPath = ensureValidPath ( path . join ( appDataPath , domain + ".key" ) )
90+
8091 const cmd = exePath + " -install -cert-file " + crtPath +
8192 " -key-file " + keyPath + " " + domain
8293 return new Promise ( ( resolve , reject ) => {
0 commit comments