Skip to content

Commit 2302337

Browse files
committed
🎨
1 parent f4b6cfb commit 2302337

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/grammar-registry.coffee

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FirstMate = require 'first-mate'
33
Token = require './token'
44
fs = require 'fs-plus'
55
Grim = require 'grim'
6+
path = require 'path'
67

78
# Extended: Syntax class holding the grammars used for tokenizing.
89
#
@@ -53,10 +54,9 @@ class GrammarRegistry extends FirstMate.GrammarRegistry
5354

5455
getGrammarPathScore: (grammar, filePath) ->
5556
return -1 unless filePath
56-
filePath = filePath.replace(/\\/g, '/') if process.platform is 'win32'
5757

58-
pathComponents = filePath.toLowerCase().split('/')
59-
pathComponents = pathComponents.concat(pathComponents.pop().split('.'))
58+
pathComponents = filePath.toLowerCase().split(path.sep)
59+
pathComponents.push(pathComponents.pop().split('.')...)
6060
pathScore = -1
6161

6262
fileTypes = grammar.fileTypes

0 commit comments

Comments
 (0)