@@ -17,13 +17,14 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
17
17
import { ILogService } from 'vs/platform/log/common/log' ;
18
18
import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile' ;
19
19
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity' ;
20
- import { Mutable , isObject , isString } from 'vs/base/common/types' ;
20
+ import { Mutable , isObject , isString , isUndefined } from 'vs/base/common/types' ;
21
21
import { getErrorMessage } from 'vs/base/common/errors' ;
22
22
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
23
23
24
24
interface IStoredProfileExtension {
25
25
identifier : IExtensionIdentifier ;
26
26
location : UriComponents | string ;
27
+ relativeLocation : string | undefined ;
27
28
version : string ;
28
29
metadata ?: Metadata ;
29
30
}
@@ -247,14 +248,23 @@ export abstract class AbstractExtensionsProfileScannerService extends Disposable
247
248
this . reportAndThrowInvalidConentError ( file ) ;
248
249
}
249
250
let location : URI ;
250
- if ( isString ( e . location ) ) {
251
+ if ( isString ( e . relativeLocation ) ) {
252
+ // Extension in new format. No migration needed.
253
+ location = this . resolveExtensionLocation ( e . relativeLocation ) ;
254
+ } else if ( isString ( e . location ) ) {
255
+ // Extension in intermediate format. Migrate to new format.
251
256
location = this . resolveExtensionLocation ( e . location ) ;
257
+ migrate = true ;
258
+ e . relativeLocation = e . location ;
259
+ // retain old format so that old clients can read it
260
+ e . location = location . toJSON ( ) ;
252
261
} else {
253
262
location = URI . revive ( e . location ) ;
254
263
const relativePath = this . toRelativePath ( location ) ;
255
264
if ( relativePath ) {
265
+ // Extension in old format. Migrate to new format.
256
266
migrate = true ;
257
- e . location = relativePath ;
267
+ e . relativeLocation = relativePath ;
258
268
}
259
269
}
260
270
extensions . push ( {
@@ -275,7 +285,9 @@ export abstract class AbstractExtensionsProfileScannerService extends Disposable
275
285
const storedProfileExtensions : IStoredProfileExtension [ ] = extensions . map ( e => ( {
276
286
identifier : e . identifier ,
277
287
version : e . version ,
278
- location : this . toRelativePath ( e . location ) ?? e . location . toJSON ( ) ,
288
+ // retain old format so that old clients can read it
289
+ location : e . location . toJSON ( ) ,
290
+ relativeLocation : this . toRelativePath ( e . location ) ,
279
291
metadata : e . metadata
280
292
} ) ) ;
281
293
await this . fileService . writeFile ( file , VSBuffer . fromString ( JSON . stringify ( storedProfileExtensions ) ) ) ;
@@ -376,6 +388,7 @@ function isStoredProfileExtension(candidate: any): candidate is IStoredProfileEx
376
388
return isObject ( candidate )
377
389
&& isIExtensionIdentifier ( candidate . identifier )
378
390
&& ( isUriComponents ( candidate . location ) || isString ( candidate . location ) )
391
+ && ( isUndefined ( candidate . relativeLocation ) || isString ( candidate . relativeLocation ) )
379
392
&& candidate . version && isString ( candidate . version ) ;
380
393
}
381
394
0 commit comments