From d4b735b208d2337a13e2d38e63c7d30a5e9fb181 Mon Sep 17 00:00:00 2001 From: Todor Totev Date: Tue, 9 Jun 2015 12:38:16 +0300 Subject: [PATCH] Fix rule for filtering platform specific files. Treat only files with ".platform" right before file extension are treated as platform specific. See https://github.com/NativeScript/nativescript-cli/issues/538 --- lib/services/platform-service.ts | 4 ++-- test/platform-service.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index bde1e242ce..15483cbaf4 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -342,8 +342,8 @@ export class PlatformService implements IPlatformService { } private static parsePlatformSpecificFileName(fileName: string, platforms: string[]): any { - var regex = util.format("^(.+?)\.(%s)(\..+?)$", platforms.join("|")); - var parsed = fileName.toLowerCase().match(new RegExp(regex, "i")); + var regex = util.format("^(.+?)\\.(%s)(\\..+?)$", platforms.join("|")); + var parsed = fileName.match(new RegExp(regex, "i")); if (parsed) { return { platform: parsed[2], diff --git a/test/platform-service.ts b/test/platform-service.ts index ce2782d899..bf0ed7001a 100644 --- a/test/platform-service.ts +++ b/test/platform-service.ts @@ -235,7 +235,7 @@ describe('Platform Service Tests', () => { // Asserts that the files in app folder are process as platform specific assert.isTrue(fs.exists(path.join(appDestFolderPath, "app" , "test1.js")).wait()); - assert.isTrue(fs.exists(path.join(appDestFolderPath, "app", "test1-js")).wait()); + assert.isFalse(fs.exists(path.join(appDestFolderPath, "app", "test1-js")).wait()); assert.isFalse(fs.exists(path.join(appDestFolderPath, "app", "test2.js")).wait()); assert.isFalse(fs.exists(path.join(appDestFolderPath, "app", "test2-js")).wait()); @@ -286,7 +286,7 @@ describe('Platform Service Tests', () => { // Asserts that the files in app folder are process as platform specific assert.isTrue(fs.exists(path.join(appDestFolderPath, "app" , "test2.js")).wait()); - assert.isTrue(fs.exists(path.join(appDestFolderPath, "app", "test2-js")).wait()); + assert.isFalse(fs.exists(path.join(appDestFolderPath, "app", "test2-js")).wait()); assert.isFalse(fs.exists(path.join(appDestFolderPath, "app", "test1.js")).wait()); assert.isFalse(fs.exists(path.join(appDestFolderPath, "app", "test1-js")).wait());