@@ -10,24 +10,16 @@ var copy = Promise.denodeify(fs.copy);
1010var readFile = Promise . denodeify ( fs . readFile ) ;
1111var writeFile = Promise . denodeify ( fs . writeFile ) ;
1212
13- function getDefaultExtractDestination ( addonName ) {
14- return path . resolve ( path . join ( '..' , addonName ) ) ;
15- }
16-
17- function getExtractDestination ( options ) {
18- return options . extractDestination || getDefaultExtractDestination ( options . addonName ) ;
19- }
20-
2113function createAddonFolder ( options ) {
22- return ensureDir ( getExtractDestination ( options ) ) ;
14+ return ensureDir ( options . destination ) ;
2315}
2416
2517function copyBlueprintFiles ( options ) {
2618 var blueprintFolderRelativePath = "../../blueprints" ;
2719 var blueprintPath = path . resolve ( __dirname , blueprintFolderRelativePath , options . blueprintName ) ;
2820
2921 var srcPath = path . join ( blueprintPath , 'files' ) ;
30- var destPath = getExtractDestination ( options ) ;
22+ var destPath = options . destination ;
3123
3224 return copy ( srcPath , destPath ) ;
3325}
@@ -40,7 +32,7 @@ function replaceInFile(file, placeholder, value) {
4032}
4133
4234function replaceInFiles ( options ) {
43- var basePath = getExtractDestination ( options ) ;
35+ var basePath = options . destination ;
4436 return Promise . map ( options . fileList , function ( relativeFilePath ) {
4537 var absoluteFilePath = path . join ( basePath , relativeFilePath ) ;
4638 return replaceInFile ( absoluteFilePath , options . placeholder , options . addonName ) ;
@@ -54,7 +46,7 @@ function copyFileIfExists(oldFile, newFile) {
5446}
5547
5648function copyAddonFiles ( options ) {
57- var destination = getExtractDestination ( options ) ;
49+ var destination = options . destination ;
5850 return Promise . map ( options . fileMappings , function ( fileMapping ) {
5951 var sourceFile = fileMapping . appFile . replace ( options . placeholder , options . addonName ) ;
6052 var destinationFile = path . join ( destination , fileMapping . addonFile ) ;
0 commit comments