Permalink
Browse files

fix windows path incompatibilities

  • Loading branch information...
millermedeiros committed Jul 13, 2012
1 parent ae3edbe commit 7aadbaca6f193c94e06532033989dd0a52d1a5f4
Showing with 16 additions and 16 deletions.
  1. +5 −0 README.mdown
  2. +1 −1 package.json
  3. +10 −15 src/js/pathProcessor.js
View
@@ -90,6 +90,11 @@ Released under the MIT license.
## Changelog
+### v0.3.2 (2012/07/13)
+
+ - fix some incopatibilities with windows paths.
+
+
### v0.3.1 (2012/02/22)
- only uses descriptions if next block after header is a paragraph (#10)
View
@@ -3,7 +3,7 @@
"description" : "Markdown based documentation generator",
"keywords" : ["markdown", "documentation", "docs", "generator"],
"homepage" : "https://github.com/millermedeiros/mdoc.git",
- "version" : "0.3.1",
+ "version" : "0.3.2",
"author" : {
"name" : "Miller Medeiros",
"url" : "http://blog.millermedeiros.com/"
View
@@ -1,6 +1,7 @@
var fs = require('fs'),
- path = require('path');
+ path = require('path'),
+ wrench = require('wrench');
function patternToRegex(pattern) {
@@ -32,6 +33,8 @@ exports.getFilesPaths = function(o){
inputFiles = exports.readDirRecursive(o.inputDir, o.include, o.exclude);
inputFiles.forEach(function(fname){
+ fname = normalizePath(fname);
+
var ext = path.extname(fname),
fileDir = path.dirname(fname).replace(o.inputDir, '');
@@ -44,6 +47,11 @@ exports.getFilesPaths = function(o){
return paths;
};
+function normalizePath(path){
+ // windows to unix
+ return path.replace(/\\/g, '/');
+}
+
exports.readDirRecursive = function(baseDir, include, exclude){
var files = [],
@@ -88,18 +96,5 @@ exports.processFile = function(fileInfo, fn){
exports.mkdirs = function(dir, mode){
- mode = mode || '0777';
-
- var paths = dir.split('/'),
- prev = '',
- cur;
-
- for (var i = 0, n = paths.length; i < n; i += 1) {
- cur = path.join(prev, paths[i]);
- if(! path.existsSync(cur) ){
- fs.mkdirSync(cur, mode);
- }
- prev = cur;
- }
-
+ wrench.mkdirSyncRecursive(dir, mode || '0777');
};

0 comments on commit 7aadbac

Please sign in to comment.