Skip to content

Commit

Permalink
Merge pull request #7 from bashmish/fix/windowsCutDrive
Browse files Browse the repository at this point in the history
Fix absolute filepath on Windows
  • Loading branch information
lahmatiy committed Nov 10, 2017
2 parents e825b88 + 868209f commit d80ca32
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.1.1 (November 10, 2017)

- Fixed absolute filepath on Windows

## 3.1.0 (October 1, 2017)

- Added `cwd` option
Expand Down
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ module.exports = function(options) {

// temporary solution
// should take in account options.base
filename = path
.join(cwd, path.resolve('/', filename))
.replace(/^[a-z]+:/i, ''); // cut drive from path on Windows platform
filename = path.join(
cwd,
path
.resolve('/', filename)
.replace(/^[a-z]+:/i, '') // cut drive from path on Windows platform
);

opener.open(filename).then(
function() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "express-open-in-editor",
"version": "3.1.0",
"version": "3.1.1",
"description": "Express middleware to open file in editor",
"author": "Roman Dvornov <rdvornov@gmail.com>",
"license": "MIT",
Expand Down

0 comments on commit d80ca32

Please sign in to comment.