From 5a78bd476303f1e60715226a8568837840fbf97d Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Fri, 9 Oct 2020 14:27:28 +0200 Subject: [PATCH 1/2] [config] Normalize returned glob path to windows for path.sep usage --- packages/config/src/android/Package.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/config/src/android/Package.ts b/packages/config/src/android/Package.ts index fc3597f064..9defee3322 100644 --- a/packages/config/src/android/Package.ts +++ b/packages/config/src/android/Package.ts @@ -25,7 +25,9 @@ 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) { From aa5d426c8a0bd8f057524889851ed3349c0f59d3 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Fri, 9 Oct 2020 14:28:02 +0200 Subject: [PATCH 2/2] [config] Use node to remove root path from package path --- packages/config/src/android/Package.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/config/src/android/Package.ts b/packages/config/src/android/Package.ts index 9defee3322..ac9e1616ab 100644 --- a/packages/config/src/android/Package.ts +++ b/packages/config/src/android/Package.ts @@ -34,7 +34,7 @@ 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('.'); }