1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-10 15:57:07 +01:00

Fix path parsing issue on prev versions of Node.js.

Work around absence of path.parse in Node versions < v0.12. Addresses
#31 and #33.
This commit is contained in:
hacksalot
2015-12-24 16:18:38 -05:00
parent 79637b611a
commit 3d41528059
4 changed files with 18 additions and 14 deletions

View File

@ -13,6 +13,7 @@ Definition of the TemplateGenerator class.
, MD = require( 'marked' )
, XML = require( 'xml-escape' )
, PATH = require('path')
, parsePath = require('parse-filepath')
, MKDIRP = require('mkdirp')
, BaseGenerator = require( './base-generator' )
, EXTEND = require('../utils/extend')
@ -127,7 +128,7 @@ Definition of the TemplateGenerator class.
var theme = themeInfo.theme;
var tFolder = themeInfo.folder;
var tplFolder = PATH.join( tFolder, 'src' );
var outFolder = PATH.parse(f).dir;
var outFolder = parsePath(f).dirname;
var curFmt = theme.getFormat( this.format );
var that = this;
@ -176,7 +177,7 @@ Definition of the TemplateGenerator class.
var absLoc = PATH.join(outFolder, loc);
var absTarg = PATH.join(PATH.dirname(absLoc), curFmt.symLinks[loc]);
// 'file', 'dir', or 'junction' (Windows only)
var type = PATH.parse( absLoc ).ext ? 'file' : 'junction';
var type = parsePath( absLoc ).extname ? 'file' : 'junction';
FS.symlinkSync( absTarg, absLoc, type);
});
}
@ -221,7 +222,7 @@ Definition of the TemplateGenerator class.
function themeFromMoniker() {
// Verify the specified theme name/path
var tFolder = PATH.join(
PATH.parse( require.resolve('fluent-themes') ).dir,
parsePath( require.resolve('fluent-themes') ).dirname,
this.opts.theme
);
var exists = require('path-exists').sync;