Skip to content

Commit

Permalink
fix windows path relative
Browse files Browse the repository at this point in the history
  • Loading branch information
khomyakov42 committed May 19, 2014
1 parent a3bdd59 commit 6687740
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/twig.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,8 @@ var Twig = (function (Twig) {
// Get the system-specific path separator
var path = require("path"),
sep = path.sep || sep_chr,
relative = new RegExp("^\\.{1,2}(?:\\\\|/)");
relative = new RegExp("^\\.{1,2}" + sep.replace("\\", "\\\\"));
file = file.replace(/\//g, sep);

if (template.base !== undefined && file.match(relative) == null) {
file = file.replace(template.base, '');
Expand Down
3 changes: 2 additions & 1 deletion twig.js
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,8 @@ var Twig = (function (Twig) {
// Get the system-specific path separator
var path = require("path"),
sep = path.sep || sep_chr,
relative = new RegExp("^\\.{1,2}(?:\\\\|/)");
relative = new RegExp("^\\.{1,2}" + sep.replace("\\", "\\\\"));
file = file.replace(/\//g, sep);

if (template.base !== undefined && file.match(relative) == null) {
file = file.replace(template.base, '');
Expand Down
Loading

0 comments on commit 6687740

Please sign in to comment.