@@ -10,7 +10,6 @@ const cp = require("child_process");
1010const utils = require ( "./utils.js" ) ;
1111const apioLog = require ( "./apio-log.js" ) ;
1212
13-
1413// Load the examples json data from apio. Before invoking this
1514// wizard we run 'apio api get-examples -o <output-file>'.
1615function loadApioExamplesData ( ) {
@@ -136,8 +135,11 @@ function getWebviewContent() {
136135
137136// Dispatched when the user submit the form to create the project.
138137async function createProjectFromExample ( context , msg , panel ) {
139- const folderPath = msg . folder . trim ( ) ;
138+ // Get the destination directory.
139+ let folderPath = msg . folder . trim ( ) ;
140140
141+ // Make sure it's absolute, though on windows, this doesn't verify that
142+ // the driver letter exists.
141143 if ( ! path . isAbsolute ( folderPath ) ) {
142144 panel . webview . postMessage ( {
143145 command : "status" ,
@@ -147,6 +149,12 @@ async function createProjectFromExample(context, msg, panel) {
147149 return ;
148150 }
149151
152+ // Use the absolute canonical form of the destination folder. On windows
153+ // for example, this include the drive letter c:\ even if the user
154+ // didn't specify it.
155+ folderPath = path . resolve ( folderPath ) ;
156+
157+ // Construct example full name.
150158 const example = msg . board + "/" + msg . example ;
151159
152160 try {
@@ -182,7 +190,7 @@ async function createProjectFromExample(context, msg, panel) {
182190 } ) ;
183191
184192 // Signal to the apio activate() that will be called on the new
185- // workspace to automatically open apio.ini.
193+ // workspace to automatically open apio.ini.
186194 await context . globalState . update ( "apio.justCreatedProject" , true ) ;
187195
188196 // Switch to the new workspace. This will start a new instance of
0 commit comments