Skip to content

Commit 29478da

Browse files
authored
Merge pull request #1645 from DivanteLtd/feature/1590
Normalize paths in installer script
2 parents 9f350c6 + 7baf1cb commit 29478da

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

core/scripts/installer.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

3+
const path = require('path')
34
const shell = require('shelljs')
45
const mkdirp = require('mkdirp')
56
const exists = require('fs-exists-sync')
@@ -133,10 +134,13 @@ class Backend extends Abstract {
133134
*/
134135
cloneRepository () {
135136
return new Promise((resolve, reject) => {
136-
Message.info(`Cloning backend into '${this.answers.backend_dir}'...`)
137+
const backendDir = path.normalize(this.answers.backend_dir)
138+
const gitPath = path.normalize(this.answers.git_path)
137139

138-
if (shell.exec(`${this.answers.git_path} clone ${STOREFRONT_BACKEND_GIT_URL} ${this.answers.backend_dir} > ${Abstract.infoLogStream} 2>&1`).code !== 0) {
139-
reject(new Error(`Can't clone backend into '${this.answers.backend_dir}'.`))
140+
Message.info(`Cloning backend into '${backendDir}'...`)
141+
142+
if (shell.exec(`${gitPath} clone ${STOREFRONT_BACKEND_GIT_URL} '${backendDir}' > ${Abstract.infoLogStream} 2>&1`).code !== 0) {
143+
reject(new Error(`Can't clone backend into '${backendDir}'.`))
140144
}
141145

142146
resolve()
@@ -150,11 +154,11 @@ class Backend extends Abstract {
150154
*/
151155
goToDirectory (backendDir = null) {
152156
return new Promise((resolve, reject) => {
153-
let dir = this.answers ? this.answers.backend_dir : backendDir
157+
const dir = this.answers ? this.answers.backend_dir : backendDir
154158

155159
Message.info(`Trying change directory to '${dir}'...`)
156160

157-
if (shell.cd(dir).code !== 0) {
161+
if (shell.cd(path.normalize(dir)).code !== 0) {
158162
reject(new Error(`Can't change directory to '${dir}'.`))
159163
}
160164

0 commit comments

Comments
 (0)