Skip to content

Commit

Permalink
Fix rule for filtering platform specific files.
Browse files Browse the repository at this point in the history
Treat only files with ".platform" right before file extension are treated as platform specific.

See #538
  • Loading branch information
teobugslayer authored and Fatme Havaluova committed Jun 23, 2015
1 parent 8962ebd commit a00c813
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
4 changes: 2 additions & 2 deletions test/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -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());

Expand Down

0 comments on commit a00c813

Please sign in to comment.