@@ -430,7 +430,7 @@ function openServerLogFile(workspacePath): Thenable<boolean> {
430430}
431431
432432async function openFormatter ( extensionPath ) {
433- let defaultFormatter = extensionPath + '/ formatters/ eclipse-formatter.xml';
433+ let defaultFormatter = path . join ( extensionPath , ' formatters' , ' eclipse-formatter.xml') ;
434434 let formatterUrl : string = getJavaConfiguration ( ) . get ( 'format.settings.url' ) ;
435435 if ( formatterUrl && formatterUrl . length > 0 ) {
436436 if ( isRemote ( formatterUrl ) ) {
@@ -447,7 +447,7 @@ async function openFormatter(extensionPath) {
447447 let file ;
448448 let relativePath ;
449449 if ( ! global ) {
450- file = path . join ( workspace . workspaceFolders [ 0 ] . uri . path , fileName ) ;
450+ file = path . join ( workspace . workspaceFolders [ 0 ] . uri . fsPath , fileName ) ;
451451 relativePath = fileName ;
452452 } else {
453453 let root = path . join ( extensionPath , '..' , 'redhat.java' ) ;
@@ -522,7 +522,7 @@ async function addFormatter(extensionPath, formatterUrl, defaultFormatter, relat
522522 if ( ! path . isAbsolute ( f ) ) {
523523 let fileName = f ;
524524 if ( ! global ) {
525- f = path . join ( workspace . workspaceFolders [ 0 ] . uri . path , fileName ) ;
525+ f = path . join ( workspace . workspaceFolders [ 0 ] . uri . fsPath , fileName ) ;
526526 relativePath = fileName ;
527527 } else {
528528 let root = path . join ( extensionPath , '..' , 'redhat.java' ) ;
@@ -541,8 +541,9 @@ async function addFormatter(extensionPath, formatterUrl, defaultFormatter, relat
541541 let action = 'Yes' ;
542542 window . showWarningMessage ( msg , action , 'No' ) . then ( ( selection ) => {
543543 if ( action === selection ) {
544- fs . createReadStream ( defaultFormatter ) . pipe ( fs . createWriteStream ( f ) ) ;
545- openDocument ( extensionPath , f , defaultFormatter , relativePath ) ;
544+ fs . createReadStream ( defaultFormatter )
545+ . pipe ( fs . createWriteStream ( f ) )
546+ . on ( 'finish' , ( ) => openDocument ( extensionPath , f , defaultFormatter , relativePath ) ) ;
546547 }
547548 } ) ;
548549 } else {
0 commit comments