Skip to content

Commit 1ec7e64

Browse files
authored
fix(cli): warn macOS users about spaces in path (#2550 by @frankcalise)
* fix(boilerplate): Podfile accounts for spaces in path * fix(cli): check for spaces in path on macOS * chore: cleanup
1 parent 75a6537 commit 1ec7e64

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

boilerplate/ios/Podfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
pod_folder = Pathname.new(__FILE__).dirname.realpath
2-
3-
require File.join(File.dirname(`cd #{pod_folder} && node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
4-
require File.join(File.dirname(`cd #{pod_folder} && node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
5-
require File.join(File.dirname(`cd #{pod_folder} && node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")
1+
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
2+
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
3+
require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")
64

75
require 'json'
86
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}

src/commands/new.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export default {
137137
const { gray, cyan, yellow, white, red, underline } = colors
138138
const options: Options = parameters.options
139139

140+
const isMac = process.platform === "darwin"
140141
const yname = boolFlag(options.y) || boolFlag(options.yes)
141142
const useDefault = (option: unknown) => yname && option === undefined
142143

@@ -218,6 +219,11 @@ export default {
218219
p?.startsWith("~") ? p.replace("~", homedir()) : p
219220
targetPath = path(handleHomePrefix(targetPath))
220221

222+
if (isMac && targetPath.indexOf(" ") !== -1) {
223+
p()
224+
p(yellow("Error: The project path cannot contain spaces."))
225+
process.exit(1)
226+
}
221227
// #endregion
222228

223229
// #region Prompt Overwrite
@@ -711,7 +717,6 @@ export default {
711717
if (!installDeps) command(packager.installCmd({ packagerName }))
712718
command(`${packagerName} start`)
713719

714-
const isMac = process.platform === "darwin"
715720
if (isMac) {
716721
command(`${packager.runCmd("ios", packagerOptions)}`)
717722
} else {

0 commit comments

Comments
 (0)