Skip to content

Commit

Permalink
Remove last path usage from specs
Browse files Browse the repository at this point in the history
This does sacrifice the ability to use Windows-style paths, but it's a
convenience function that does "magic" stuff to its argument anyways,
so I don't see it as much of a loss.
  • Loading branch information
valadaptive committed Jan 14, 2024
1 parent 03391e5 commit d306ba4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
/** IDL to protocol (services) and schema (types) parsing logic. */

let files = require('./files'),
utils = require('./utils'),
path = require('path');
utils = require('./utils');


// Default type references defined by Avro.
Expand Down Expand Up @@ -197,7 +196,7 @@ function assembleProtocol(fpath, opts, cb) {
*
* The parsing logic is as follows:
*
* + If `str` contains `path.sep` (on windows `\`, otherwise `/`) and is a path
* + If `str` contains `/` and is a path
* to an existing file, it will first be read as JSON, then as an IDL
* specification if JSON parsing failed. If either succeeds, the result is
* returned, otherwise the next steps are run using the file's content
Expand All @@ -213,7 +212,7 @@ function read(str) {
let schema;
if (
typeof str == 'string' &&
~str.indexOf(path.sep) &&
str.indexOf('/') !== -1 &&
files.existsSync(str)
) {
// Try interpreting `str` as path to a file contain a JSON schema or an IDL
Expand Down

0 comments on commit d306ba4

Please sign in to comment.