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

Commit

Permalink
[config] Fix Android scandir error when ejecting on windows (#2774)
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric authored Oct 9, 2020
1 parent 385603f commit 6973eb6
Showing 1 changed file with 4 additions and 2 deletions.
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]);
}

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);

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

0 comments on commit 6973eb6

Please sign in to comment.