@@ -18,7 +18,7 @@ import { isLinux } from 'vs/base/common/platform';
1818import { ConfigurationModel } from 'vs/platform/configuration/common/configurationModels' ;
1919import { WorkspaceConfigurationModelParser , FolderSettingsModelParser , StandaloneConfigurationModelParser } from 'vs/workbench/services/configuration/common/configurationModels' ;
2020import { FOLDER_SETTINGS_PATH , TASKS_CONFIGURATION_KEY , FOLDER_SETTINGS_NAME , LAUNCH_CONFIGURATION_KEY } from 'vs/workbench/services/configuration/common/configuration' ;
21- import { IStoredWorkspaceFolder , IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces' ;
21+ import { IStoredWorkspaceFolder } from 'vs/platform/workspaces/common/workspaces' ;
2222import * as extfs from 'vs/base/node/extfs' ;
2323import { JSONEditingService } from 'vs/workbench/services/configuration/node/jsonEditingService' ;
2424import { WorkbenchState , IWorkspaceFolder } from 'vs/platform/workspace/common/workspace' ;
@@ -29,6 +29,11 @@ import { Schemas } from 'vs/base/common/network';
2929import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
3030import { IConfigurationModel } from 'vs/platform/configuration/common/configuration' ;
3131
32+ export interface IWorkspaceIdentifier {
33+ id : string ;
34+ configPath : URI ;
35+ }
36+
3237export class WorkspaceConfiguration extends Disposable {
3338
3439 private readonly _cachedConfiguration : CachedWorkspaceConfiguration ;
@@ -75,7 +80,7 @@ export class WorkspaceConfiguration extends Disposable {
7580
7681 setFolders ( folders : IStoredWorkspaceFolder [ ] , jsonEditingService : JSONEditingService ) : Promise < void > {
7782 if ( this . _workspaceIdentifier ) {
78- return jsonEditingService . write ( URI . file ( this . _workspaceIdentifier . configPath ) , { key : 'folders' , value : folders } , true )
83+ return jsonEditingService . write ( this . _workspaceIdentifier . configPath , { key : 'folders' , value : folders } , true )
7984 . then ( ( ) => this . reload ( ) ) ;
8085 }
8186 return Promise . resolve ( ) ;
@@ -102,7 +107,7 @@ export class WorkspaceConfiguration extends Disposable {
102107 }
103108 return false ;
104109 }
105- if ( URI . file ( this . _workspaceIdentifier . configPath ) . scheme === Schemas . file ) {
110+ if ( this . _workspaceIdentifier . configPath . scheme === Schemas . file ) {
106111 if ( ! ( this . _workspaceConfiguration instanceof NodeBasedWorkspaceConfiguration ) ) {
107112 dispose ( this . _workspaceConfiguration ) ;
108113 this . _workspaceConfiguration = new NodeBasedWorkspaceConfiguration ( ) ;
@@ -120,7 +125,7 @@ export class WorkspaceConfiguration extends Disposable {
120125 }
121126
122127 private updateCache ( ) : Promise < void > {
123- if ( this . _workspaceIdentifier && URI . file ( this . _workspaceIdentifier . configPath ) . scheme !== Schemas . file && this . _workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration ) {
128+ if ( this . _workspaceIdentifier && this . _workspaceIdentifier . configPath . scheme !== Schemas . file && this . _workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration ) {
124129 return this . _workspaceConfiguration . load ( this . _workspaceIdentifier )
125130 . then ( ( ) => this . _cachedConfiguration . updateWorkspace ( this . _workspaceIdentifier , this . _workspaceConfiguration . getConfigurationModel ( ) ) ) ;
126131 }
@@ -195,7 +200,7 @@ abstract class AbstractWorkspaceConfiguration extends Disposable implements IWor
195200class NodeBasedWorkspaceConfiguration extends AbstractWorkspaceConfiguration {
196201
197202 protected loadWorkspaceConfigurationContents ( workspaceIdentifier : IWorkspaceIdentifier ) : Promise < string > {
198- return pfs . readFile ( workspaceIdentifier . configPath )
203+ return pfs . readFile ( workspaceIdentifier . configPath . fsPath )
199204 . then ( contents => contents . toString ( ) , e => {
200205 errors . onUnexpectedError ( e ) ;
201206 return '' ;
@@ -211,13 +216,13 @@ class FileServiceBasedWorkspaceConfiguration extends AbstractWorkspaceConfigurat
211216
212217 constructor ( private fileService : IFileService , from ?: AbstractWorkspaceConfiguration ) {
213218 super ( from ) ;
214- this . workspaceConfig = from ? URI . file ( from . workspaceIdentifier . configPath ) : null ;
219+ this . workspaceConfig = from ? from . workspaceIdentifier . configPath : null ;
215220 this . _register ( fileService . onFileChanges ( e => this . handleWorkspaceFileEvents ( e ) ) ) ;
216221 this . reloadConfigurationScheduler = this . _register ( new RunOnceScheduler ( ( ) => this . _onDidChange . fire ( ) , 50 ) ) ;
217222 }
218223
219224 protected loadWorkspaceConfigurationContents ( workspaceIdentifier : IWorkspaceIdentifier ) : Promise < string > {
220- this . workspaceConfig = URI . file ( workspaceIdentifier . configPath ) ;
225+ this . workspaceConfig = workspaceIdentifier . configPath ;
221226 return this . fileService . resolveContent ( this . workspaceConfig )
222227 . then ( content => content . value , e => {
223228 errors . onUnexpectedError ( e ) ;
0 commit comments