Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

fix(config): use basename to avoid mixed path separators from glob #2319

Merged
merged 1 commit into from
Jul 2, 2020

Conversation

byCedric
Copy link
Member

@byCedric byCedric commented Jun 26, 2020

Fixes #2312
Fixes #2326

I noticed glob returning paths with the forward-slash on Windows environments, even though the path.sep correctly returns a backslash. This uses the path.basename to resolve the last folder, regardless of the platform separator.

To outline the issue, here is a log that I used in getProjectName to log the exact output of the projectRoot, sourceRoot, sourceRootParts, path.sep, the bad result (old implementation), and the good result (new implementation):

getProjectName {
  projectRoot: 'C:\\Users\\cedri\\Desktop\\expo-cli\\test-project',
  sourceRoot: 'C:/Users/cedri/Desktop/expo-cli/test-project/ios/testproject',
  sourceRootParts: [ 'C:/Users/cedri/Desktop/expo-cli/test-project/ios/testproject' ],
  resultBad: 'C:/Users/cedri/Desktop/expo-cli/test-project/ios/testproject',
  resultGood: 'testproject',
  pathsep: '\\'
}

@brentvatne brentvatne merged commit 0fe060d into master Jul 2, 2020
@brentvatne brentvatne deleted the @bycedric/windows/fix-eject branch July 2, 2020 20:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid argument error while ejecting expo eject is not working on Windows
2 participants