Skip to content

Commit

Permalink
Add/fix Windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke committed Jul 17, 2018
1 parent 42e54fb commit d4f6904
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ usersV2.find().then(items => console.log('.find()', items));

## Release History

__0.2.2__

- Fix/add support for win32 systems

__0.2.0__

- Add app.versionate as main function
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "feathers-versionate",
"description": "feathersjs service nesting utility",
"version": "0.2.1",
"version": "0.2.2",
"keywords": [
"feathers",
"feathersjs",
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const path = require('path');
const pathJoin = require('./pathJoin.js');
const Proto = require('uberproto');

const service = function (name, basePath, subItem = false) {
Expand All @@ -9,12 +9,12 @@ const service = function (name, basePath, subItem = false) {
const use = function () {
const args = Array.from(arguments);
const subPath = args.shift();
app.use(path.join(basePath, subPath), ...args);
app.use(pathJoin(basePath, subPath), ...args);
}

// Relay service to app.service with basePath applied
const service = function (subPath) {
return app.service(path.join(basePath, subPath));
return app.service(pathJoin(basePath, subPath));
}

// Create an object that will be added to `app`
Expand Down
7 changes: 7 additions & 0 deletions src/pathJoin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var path = require('path');

module.exports = function (args1, args2 /*, ... argsN*/ ) {
var fullPath = path.join.apply(null, arguments);
// If the platform is windows, swap back slashes to forward slashes
return (process.platform === 'win32') ? fullPath.replace(/\\/g, '/') : fullPath;
}

0 comments on commit d4f6904

Please sign in to comment.