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

[config] Fix Android scandir error when ejecting on windows #2774

Merged
merged 2 commits into from
Oct 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/config/src/android/Package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ function getMainApplicationPath({
cwd: packageRoot,
});
// If there's more than one, we'll probably have a problem.
return mainApplications[0];
// Also, glob always returns a posix formatted path (even on windows),
// lets normalize that so we can use it with `.split(path.sep)`
return path.normalize(mainApplications[0]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@byCedric - maybe we should make a wrapper around glob that always returns a normalized path to stop this from biting us in the future

}

function getCurrentPackageName(projectRoot: string) {
const packageRoot = getPackageRoot(projectRoot);
const mainApplicationPath = getMainApplicationPath({ projectRoot, packageRoot });
const packagePath = path.dirname(mainApplicationPath);
const packagePathParts = packagePath.replace(packageRoot, '').split(path.sep).filter(Boolean);
const packagePathParts = path.relative(packageRoot, packagePath).split(path.sep).filter(Boolean);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clever


return packagePathParts.join('.');
}
Expand Down