Skip to content

Commit aa253f4

Browse files
authored
Merge pull request #62 from YuvalBubnovsky/bugfix/platform_agnostic_path_generation
bugfix: platform agnostic path generation
2 parents 40f649d + 0c42207 commit aa253f4

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/cot.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@ import Color from './utils/color.js';
3333
import JSONCoT, { Detail } from './types/types.js'
3434
import AJV from 'ajv';
3535
import fs from 'fs';
36+
import path from 'node:path';
37+
import { fileURLToPath } from 'node:url';
3638

3739
// GeoJSON Geospatial ops will truncate to the below
3840
const COORDINATE_PRECISION = 6;
3941

40-
const RootMessage = await protobuf.load(new URL('./proto/takmessage.proto', import.meta.url).pathname);
42+
const protoPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'proto', 'takmessage.proto');
43+
const RootMessage = await protobuf.load(protoPath);
4144

4245
const pkg = JSON.parse(String(fs.readFileSync(new URL('../package.json', import.meta.url))));
4346

lib/data-package.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ export class DataPackage {
204204
strict?: boolean
205205
cleanup?: boolean
206206
}): Promise<DataPackage> {
207-
input = input instanceof URL ? decodeURIComponent(input.pathname) : input;
208-
207+
input = input instanceof URL ? path.normalize(decodeURIComponent(input.pathname)) : input;
209208
if (!opts) opts = {};
210209
if (opts.strict === undefined) opts.strict = true;
211210
if (opts.cleanup === undefined) opts.cleanup = true;

0 commit comments

Comments
 (0)