Skip to content

Commit

Permalink
Fix path separator for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rajendrant committed Dec 19, 2018
1 parent 1c29bbc commit 36bf873
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion fuzzaldrin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports =
obj.filter(query, options)

score: (candidate, query, options = {}) ->
binding.score candidate, query, options
options = parseOptions(options)
binding.score candidate, query, options.usePathScoring, options.useExtensionBonus

prepareQuery: ->
14 changes: 11 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"devDependencies": {
"fuzzaldrin-plus": "^0.6.0",
"jasmine-node": "^1.16.2",
"prebuildify": "^2.6.0"
"prebuildify": "^2.6.0",
"growl": ">=1.10.0"
},
"repository": {
"type": "git",
Expand Down
8 changes: 6 additions & 2 deletions spec/test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ testPathScorer = ->
[path.join('app', 'components', 'admin', 'member', 'modals', 'edit-payment.html'), 'member edit htm'],
[path.join('matchOptimisticB.htaccess'), 'mob.h', useExtensionBonus: true],
[path.join('matchOptimisticB_main.html'), 'mob.h', useExtensionBonus: true],
['0\\Diagnostic', 'diag'],
['0\\Diagnostic', 'diag0'],
['0\\0\\0\\diagnostics00', 'diag'],
['0\\0\\0\\diagnostics00', 'diag0'],
]
for test in tests
test[2] ?= {}
Expand Down Expand Up @@ -97,6 +101,6 @@ testBenchmark = ->
fuzzaldrinExpected.filter filenames, 'da', maxResults: 10
console.timeEnd('legacy')

# testPathScorer()
testPathScorer()
# testFilter()
testBenchmark()
# testBenchmark()
4 changes: 4 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ struct Options {
bool allowErrors = false;
bool usePathScoring = true;
bool useExtensionBonus = false;
#ifdef _WIN32
char pathSeparator = '\\';
#else
char pathSeparator = '/';
#endif
const PreparedQuery preparedQuery;

Options(const string &query, size_t maxResults, bool usePathScoring, bool useExtensionBonus) : max_results(maxResults), usePathScoring(usePathScoring), useExtensionBonus(useExtensionBonus), preparedQuery(query, pathSeparator) {}
Expand Down

0 comments on commit 36bf873

Please sign in to comment.