Skip to content

Conversation

@hendricjabs
Copy link
Contributor

Summary:

When initializing a project in a folder with spaces in the name, the commandline output showed a command which is not working for these folders. In general it is not recommended to create folders with spaces but in a Windows Environment it is quite common e.g. if the username is "John Doe" and you want to initialize a react-native project in a subfolder of the home directory.

To provide a working command id added quotes around the projectDir variable, so the command can be Copy & Pasted.

Test Plan:

  1. Create a directory with spaces in the name: mkdir "my repositories"
  2. Switch to this directory cd "my repositories"
  3. Run react-native init testproject
  4. Before this change the following output was generated:
    [...]
Run instructions for iOS:
   • cd /home/johndoe/my repositories/testproject && npx react-native run-ios
   - or -
   • Open testproject/ios/testproject.xcodeproj in Xcode or run "xed -b ios"
   • Hit the Run button

 Run instructions for Android:
   • Have an Android emulator running (quickest way to get started), or a device connected.
   • cd /home/johndoe/my repositories/testproject && npx react-native run-android
  1. Copy & Paste the command and run it cd /home/johndoe/my repositories/testproject && npx react-native run-android
  2. Following error message occurs: -bash: cd: too many arguments

With this Pull Request the project directory is surrounded by quotes and a copy & paste of the command will work.

@grabbou
Copy link
Member

grabbou commented Feb 16, 2020

Thanks for the PR! This makes a lot of sense and we have recently fixed a similar issue related to this!

@thymikee thymikee merged commit f55341d into react-native-community:master Feb 16, 2020
@hendricjabs hendricjabs deleted the fix-run-instructions-output branch February 16, 2020 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants