@@ -123,9 +123,6 @@ export class Katacoda extends Runner {
123
123
124
124
runCreateProject ( step : Step , command :Command ) : RunResult {
125
125
126
- let params = command . parameters ;
127
- let language = params [ 0 ] ;
128
- let name = params [ 1 ] ;
129
126
130
127
// generate template to change directory, if the current directory is not equal to the required start directory
131
128
let cdCommand = this . changeCurrentDir ( path . join ( "/root" , "devonfw" ) ) ;
@@ -136,9 +133,9 @@ export class Katacoda extends Runner {
136
133
} ) ;
137
134
138
135
//update current directory
139
- this . currentDir = path . join ( this . currentDir , "workspace" , "main" , name ) ;
136
+ this . currentDir = path . join ( this . currentDir , "workspace" , "main" , command . parameters [ 1 ] ) ;
140
137
141
- this . renderTemplate ( "createProject.md" , this . outputPathTutorial + "step" + ( this . stepsCount ++ ) + ".md" , { text : step . text , textAfter : step . textAfter , cdCommand : cdCommand , language : language , name : name } ) ;
138
+ this . renderTemplate ( "createProject.md" , this . outputPathTutorial + "step" + ( this . stepsCount ++ ) + ".md" , { text : step . text , textAfter : step . textAfter , cdCommand : cdCommand , language : command . parameters [ 0 ] , name : command . parameters [ 1 ] } ) ;
142
139
return null ;
143
140
}
144
141
@@ -159,14 +156,18 @@ export class Katacoda extends Runner {
159
156
this . assetManager . registerFile ( setupFile , "setup/setup.txt" , "/root/setup" , false ) ;
160
157
}
161
158
162
- private changeCurrentDir ( dir :string ) :string {
159
+ private changeCurrentDir ( targetDir :string ) :string {
160
+ if ( this . currentDir == targetDir ) {
161
+ return "" ;
162
+ }
163
163
let dirUtils = new DirUtils ( ) ;
164
- let dirPath = dirUtils . getCdParam ( this . currentDir , dir ) ;
165
- this . currentDir = dir ;
164
+ let dir = dirUtils . getCdParam ( this . currentDir , targetDir ) ;
165
+
166
+ this . currentDir = targetDir ;
166
167
167
168
//create template to change directory
168
169
let template = fs . readFileSync ( path . join ( this . getRunnerDirectory ( ) , "templates" , 'cd.md' ) , 'utf8' ) ;
169
- return ejs . render ( template , { dirPath : dirPath } ) ;
170
+ return ejs . render ( template , { dir : dir } ) ;
170
171
}
171
172
172
173
0 commit comments