@@ -136,7 +136,7 @@ import {
136136} from "./vcastUtilities" ;
137137
138138import fs = require( "fs" ) ;
139- import { getNonce } from "./manage/manageSrc/manageUtils" ;
139+ import { getNonce , resolveWebviewBase } from "./manage/manageSrc/manageUtils" ;
140140const path = require ( "path" ) ;
141141let messagePane : vscode . OutputChannel = vscode . window . createOutputChannel (
142142 "VectorCAST Test Explorer"
@@ -744,20 +744,19 @@ function configureExtension(context: vscode.ExtensionContext) {
744744 const addTestsuiteToCompiler = vscode . commands . registerCommand (
745745 "vectorcastTestExplorer.addTestsuiteToCompiler" ,
746746 async ( node : any ) => {
747+ const manageWebviewSrcDir = resolveWebviewBase ( context ) ;
747748 const panel = vscode . window . createWebviewPanel (
748749 "addTestsuiteToCompiler" ,
749750 "Add Testsuite to Compiler" ,
750751 vscode . ViewColumn . Active ,
751752 {
752753 enableScripts : true ,
753754 retainContextWhenHidden : true ,
754- localResourceRoots : [
755- vscode . Uri . file ( path . join ( context . extensionPath , "src" , "manage" ) ) ,
756- ] ,
755+ localResourceRoots : [ vscode . Uri . file ( manageWebviewSrcDir ) ] ,
757756 }
758757 ) ;
759758
760- panel . webview . html = getTestsuiteWebviewContent ( context , panel ) ;
759+ panel . webview . html = await getTestsuiteWebviewContent ( context , panel ) ;
761760
762761 panel . webview . onDidReceiveMessage ( ( message ) => {
763762 if ( message . command === "submit" ) {
@@ -779,11 +778,11 @@ function configureExtension(context: vscode.ExtensionContext) {
779778 context . subscriptions . push ( addTestsuiteToCompiler ) ;
780779
781780 // Webview HTML content.
782- function getTestsuiteWebviewContent (
781+ async function getTestsuiteWebviewContent (
783782 context : vscode . ExtensionContext ,
784783 panel : vscode . WebviewPanel
785- ) : string {
786- const base = path . join ( context . extensionPath , "src" , "manage" , "webviews" ) ;
784+ ) : Promise < string > {
785+ const base = resolveWebviewBase ( context ) ;
787786
788787 // on-disk locations
789788 const cssOnDisk = vscode . Uri . file (
@@ -1182,22 +1181,23 @@ async function installPreActivationEventHandlers(
11821181 const importEnviroToProject = vscode . commands . registerCommand (
11831182 "vectorcastTestExplorer.importEnviroToProject" ,
11841183 async ( _args : vscode . Uri , argList : vscode . Uri [ ] ) => {
1184+ const manageWebviewSrcDir = await resolveWebviewBase ( context ) ;
11851185 const panel = vscode . window . createWebviewPanel (
11861186 "importEnviroToProject" ,
11871187 "Import Environment to Project" ,
11881188 vscode . ViewColumn . Active ,
11891189 {
11901190 enableScripts : true ,
11911191 retainContextWhenHidden : true ,
1192- localResourceRoots : [
1193- vscode . Uri . file (
1194- path . join ( context . extensionPath , "src" , "manage" , "webviews" )
1195- ) ,
1196- ] ,
1192+ localResourceRoots : [ vscode . Uri . file ( manageWebviewSrcDir ) ] ,
11971193 }
11981194 ) ;
11991195
1200- panel . webview . html = getImportEnvWebviewContent ( context , panel , argList ) ;
1196+ panel . webview . html = await getImportEnvWebviewContent (
1197+ context ,
1198+ panel ,
1199+ argList
1200+ ) ;
12011201
12021202 panel . webview . onDidReceiveMessage (
12031203 async ( message ) => {
@@ -1247,23 +1247,20 @@ async function installPreActivationEventHandlers(
12471247 const addEnviroToProject = vscode . commands . registerCommand (
12481248 "vectorcastTestExplorer.addEnviroToProject" ,
12491249 async ( _projectNode : any ) => {
1250+ const manageWebviewSrcDir = resolveWebviewBase ( context ) ;
12501251 const panel = vscode . window . createWebviewPanel (
12511252 "addEnviroToProject" ,
12521253 "Add Environment To Project" ,
12531254 vscode . ViewColumn . Active ,
12541255 {
12551256 enableScripts : true ,
12561257 retainContextWhenHidden : true ,
1257- localResourceRoots : [
1258- vscode . Uri . file (
1259- path . join ( context . extensionPath , "src" , "manage" , "webviews" )
1260- ) ,
1261- ] ,
1258+ localResourceRoots : [ vscode . Uri . file ( manageWebviewSrcDir ) ] ,
12621259 }
12631260 ) ;
12641261
12651262 // no initial env files
1266- panel . webview . html = getImportEnvWebviewContent ( context , panel , [ ] ) ;
1263+ panel . webview . html = await getImportEnvWebviewContent ( context , panel , [ ] ) ;
12671264
12681265 panel . webview . onDidReceiveMessage (
12691266 async ( message ) => {
@@ -1330,12 +1327,12 @@ async function installPreActivationEventHandlers(
13301327 *
13311328 * The label "Source Files" is replaced with "Env Files" in this version.
13321329 */
1333- function getImportEnvWebviewContent (
1330+ async function getImportEnvWebviewContent (
13341331 context : vscode . ExtensionContext ,
13351332 panel : vscode . WebviewPanel ,
13361333 argList : vscode . Uri [ ]
1337- ) : string {
1338- const base = path . join ( context . extensionPath , "src" , "manage" , "webviews" ) ;
1334+ ) : Promise < string > {
1335+ const base = resolveWebviewBase ( context ) ;
13391336
13401337 // on-disk resource locations
13411338 const cssOnDisk = vscode . Uri . file ( path . join ( base , "css" , "importEnv.css" ) ) ;
@@ -1388,22 +1385,23 @@ async function installPreActivationEventHandlers(
13881385 const newEnviroInProjectVCASTCommand = vscode . commands . registerCommand (
13891386 "vectorcastTestExplorer.newEnviroInProjectVCAST" ,
13901387 async ( _args : vscode . Uri , argList : vscode . Uri [ ] ) => {
1388+ const manageWebviewSrcDir = resolveWebviewBase ( context ) ;
13911389 const panel = vscode . window . createWebviewPanel (
13921390 "newEnvProject" ,
13931391 "Create Environment in Project" ,
13941392 vscode . ViewColumn . Active ,
13951393 {
13961394 enableScripts : true ,
13971395 retainContextWhenHidden : true ,
1398- localResourceRoots : [
1399- vscode . Uri . file (
1400- path . join ( context . extensionPath , "src" , "manage" , "webviews" )
1401- ) ,
1402- ] ,
1396+ localResourceRoots : [ vscode . Uri . file ( manageWebviewSrcDir ) ] ,
14031397 }
14041398 ) ;
14051399
1406- panel . webview . html = getNewEnvWebviewContent ( context , panel , argList ) ;
1400+ panel . webview . html = await getNewEnvWebviewContent (
1401+ context ,
1402+ panel ,
1403+ argList
1404+ ) ;
14071405
14081406 panel . webview . onDidReceiveMessage (
14091407 async ( message ) => {
@@ -1436,12 +1434,12 @@ async function installPreActivationEventHandlers(
14361434 ) ;
14371435 context . subscriptions . push ( newEnviroInProjectVCASTCommand ) ;
14381436
1439- function getNewEnvWebviewContent (
1437+ async function getNewEnvWebviewContent (
14401438 context : vscode . ExtensionContext ,
14411439 panel : vscode . WebviewPanel ,
14421440 argList : vscode . Uri [ ]
1443- ) : string {
1444- const base = path . join ( context . extensionPath , "src" , "manage" , "webviews" ) ;
1441+ ) : Promise < string > {
1442+ const base = resolveWebviewBase ( context ) ;
14451443 const cssOnDisk = vscode . Uri . file (
14461444 path . join ( base , "css" , "newEnvProject.css" )
14471445 ) ;
0 commit comments