From 57d765b11186354d4da842636dd97c79713d7f88 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Wed, 9 Aug 2017 13:38:57 +0300 Subject: [PATCH] Fix tns run ios on case sensitive file system In case the file system is case sensitive, `tns run ios` command fails to execute as the `entitlements` file from `app/App_Resources/iOS/` (in case there's such file) is copied to `/platforms/ios` dir (the name of iOS dir inside platforms is lowercased). However the entitlements service expects it to be inside `/platforms/iOS` dir. On case sensitive file systems we fail with ENOENT error, as there's no iOS directory. Fix this inside `entitlements service` to use lowercased value. This way it will successfully find the entitlements file inside platforms dir. --- lib/services/ios-entitlements-service.ts | 2 +- test/ios-entitlements-service.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/services/ios-entitlements-service.ts b/lib/services/ios-entitlements-service.ts index e30be51f54..74662bea78 100644 --- a/lib/services/ios-entitlements-service.ts +++ b/lib/services/ios-entitlements-service.ts @@ -22,7 +22,7 @@ export class IOSEntitlementsService { } public getPlatformsEntitlementsPath(projectData: IProjectData) : string { - return path.join(projectData.platformsDir, this.$devicePlatformsConstants.iOS, + return path.join(projectData.platformsDir, this.$devicePlatformsConstants.iOS.toLowerCase(), projectData.projectName, projectData.projectName + ".entitlements"); } public getPlatformsEntitlementsRelativePath(projectData: IProjectData): string { diff --git a/test/ios-entitlements-service.ts b/test/ios-entitlements-service.ts index 5c9f950531..0987039ad6 100644 --- a/test/ios-entitlements-service.ts +++ b/test/ios-entitlements-service.ts @@ -64,6 +64,12 @@ describe("IOSEntitlements Service Tests", () => { let actual = iOSEntitlementsService.getPlatformsEntitlementsRelativePath(projectData); assert.equal(actual, expected); }); + + it("Ensure full path to entitlements in platforms dir is correct", () => { + const expected = path.join(projectData.platformsDir, "ios", "testApp", "testApp.entitlements"); + const actual = iOSEntitlementsService.getPlatformsEntitlementsPath(projectData); + assert.equal(actual, expected); + }); }); describe("Merge", () => {