Skip to content

Commit

Permalink
[8.6] [timelion] Fix glob path on windows (elastic#152866) (elastic#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz authored Mar 9, 2023
1 parent 8c099ed commit 628cb54
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugins/vis_types/timelion/server/lib/load_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import _ from 'lodash';
import globby from 'globby';
import path from 'path';
import normalizePath from 'normalize-path';
import processFunctionDefinition from './process_function_definition';

export default function (directory) {
Expand All @@ -19,7 +20,7 @@ export default function (directory) {
// Get a list of all files and use the filename as the object key
const files = _.map(
globby
.sync(path.resolve(__dirname, '../' + directory + '/*.js'))
.sync(normalizePath(path.resolve(__dirname, '../' + directory + '/*.js')))
.filter((filename) => !filename.includes('.test')),
function (file) {
const name = file.substring(file.lastIndexOf('/') + 1, file.lastIndexOf('.'));
Expand All @@ -29,7 +30,7 @@ export default function (directory) {

// Get a list of all directories with an index.js, use the directory name as the key in the object
const directories = _.chain(
globby.sync(path.resolve(__dirname, '../' + directory + '/*/index.js'))
globby.sync(normalizePath(path.resolve(__dirname, '../' + directory + '/*/index.js')))
)
.map(function (file) {
const parts = file.split('/');
Expand Down

0 comments on commit 628cb54

Please sign in to comment.