@@ -61,8 +61,6 @@ import { LogLevelSetterChannel } from 'vs/platform/log/common/logIpc';
6161import { setUnexpectedErrorHandler } from 'vs/base/common/errors' ;
6262import { ElectronURLListener } from 'vs/platform/url/electron-main/electronUrlListener' ;
6363import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver' ;
64- import { join } from 'path' ;
65- import { exists , unlink , del } from 'vs/base/node/pfs' ;
6664
6765export class CodeApplication {
6866
@@ -264,53 +262,49 @@ export class CodeApplication {
264262 this . logService . debug ( `from: ${ this . environmentService . appRoot } ` ) ;
265263 this . logService . debug ( 'args:' , this . environmentService . args ) ;
266264
267- // Handle local storage (TODO@Ben remove me after a while)
268- return this . handleLocalStorage ( ) . then ( ( ) => {
269-
270- // Make sure we associate the program with the app user model id
271- // This will help Windows to associate the running program with
272- // any shortcut that is pinned to the taskbar and prevent showing
273- // two icons in the taskbar for the same app.
274- if ( platform . isWindows && product . win32AppUserModelId ) {
275- app . setAppUserModelId ( product . win32AppUserModelId ) ;
276- }
265+ // Make sure we associate the program with the app user model id
266+ // This will help Windows to associate the running program with
267+ // any shortcut that is pinned to the taskbar and prevent showing
268+ // two icons in the taskbar for the same app.
269+ if ( platform . isWindows && product . win32AppUserModelId ) {
270+ app . setAppUserModelId ( product . win32AppUserModelId ) ;
271+ }
277272
278- // Create Electron IPC Server
279- this . electronIpcServer = new ElectronIPCServer ( ) ;
273+ // Create Electron IPC Server
274+ this . electronIpcServer = new ElectronIPCServer ( ) ;
280275
281- // Resolve unique machine ID
282- this . logService . trace ( 'Resolving machine identifier...' ) ;
283- return this . resolveMachineId ( ) . then ( machineId => {
284- this . logService . trace ( `Resolved machine identifier: ${ machineId } ` ) ;
276+ // Resolve unique machine ID
277+ this . logService . trace ( 'Resolving machine identifier...' ) ;
278+ return this . resolveMachineId ( ) . then ( machineId => {
279+ this . logService . trace ( `Resolved machine identifier: ${ machineId } ` ) ;
285280
286- // Spawn shared process
287- this . sharedProcess = new SharedProcess ( this . environmentService , this . lifecycleService , this . logService , machineId , this . userEnv ) ;
288- this . sharedProcessClient = this . sharedProcess . whenReady ( ) . then ( ( ) => connect ( this . environmentService . sharedIPCHandle , 'main' ) ) ;
281+ // Spawn shared process
282+ this . sharedProcess = new SharedProcess ( this . environmentService , this . lifecycleService , this . logService , machineId , this . userEnv ) ;
283+ this . sharedProcessClient = this . sharedProcess . whenReady ( ) . then ( ( ) => connect ( this . environmentService . sharedIPCHandle , 'main' ) ) ;
289284
290- // Services
291- const appInstantiationService = this . initServices ( machineId ) ;
285+ // Services
286+ const appInstantiationService = this . initServices ( machineId ) ;
292287
293- let promise : TPromise < any > = TPromise . as ( null ) ;
288+ let promise : TPromise < any > = TPromise . as ( null ) ;
294289
295- // Create driver
296- if ( this . environmentService . driverHandle ) {
297- serveDriver ( this . electronIpcServer , this . environmentService . driverHandle , appInstantiationService ) . then ( server => {
298- this . logService . info ( 'Driver started at:' , this . environmentService . driverHandle ) ;
299- this . toDispose . push ( server ) ;
300- } ) ;
301- }
290+ // Create driver
291+ if ( this . environmentService . driverHandle ) {
292+ serveDriver ( this . electronIpcServer , this . environmentService . driverHandle , appInstantiationService ) . then ( server => {
293+ this . logService . info ( 'Driver started at:' , this . environmentService . driverHandle ) ;
294+ this . toDispose . push ( server ) ;
295+ } ) ;
296+ }
302297
303- return promise . then ( ( ) => {
304- // Setup Auth Handler
305- const authHandler = appInstantiationService . createInstance ( ProxyAuthHandler ) ;
306- this . toDispose . push ( authHandler ) ;
298+ return promise . then ( ( ) => {
299+ // Setup Auth Handler
300+ const authHandler = appInstantiationService . createInstance ( ProxyAuthHandler ) ;
301+ this . toDispose . push ( authHandler ) ;
307302
308- // Open Windows
309- appInstantiationService . invokeFunction ( accessor => this . openFirstWindow ( accessor ) ) ;
303+ // Open Windows
304+ appInstantiationService . invokeFunction ( accessor => this . openFirstWindow ( accessor ) ) ;
310305
311- // Post Open Windows Tasks
312- appInstantiationService . invokeFunction ( accessor => this . afterWindowOpen ( accessor ) ) ;
313- } ) ;
306+ // Post Open Windows Tasks
307+ appInstantiationService . invokeFunction ( accessor => this . afterWindowOpen ( accessor ) ) ;
314308 } ) ;
315309 } ) ;
316310 }
@@ -330,29 +324,6 @@ export class CodeApplication {
330324 } ) ;
331325 }
332326
333- private handleLocalStorage ( ) : TPromise < void > {
334- const localStorageBackupFile = join ( this . environmentService . userDataPath , 'Local Storage' , 'file__0.localstorage.vscbak' ) ;
335- const localStorageJournalBackupFile = join ( this . environmentService . userDataPath , 'Local Storage' , 'file__0.localstorage-journal.vscbak' ) ;
336- const localStorageLevelDB = join ( this . environmentService . userDataPath , 'Local Storage' , 'leveldb' ) ;
337-
338- // Electron 1.7.12: Delete
339- if ( product . quality === 'insider' && process . versions . electron === '1.7.12' ) {
340- return exists ( localStorageBackupFile ) . then ( localStorageBackupFileExists => {
341- return exists ( localStorageJournalBackupFile ) . then ( localStorageJournalBackupFileExists => {
342- return exists ( localStorageLevelDB ) . then ( localStorageLevelDBExists => {
343- return TPromise . join ( [
344- localStorageBackupFileExists ? unlink ( localStorageBackupFile ) : TPromise . as ( null ) ,
345- localStorageJournalBackupFileExists ? unlink ( localStorageJournalBackupFile ) : TPromise . as ( null ) ,
346- localStorageLevelDBExists ? del ( localStorageLevelDB ) : TPromise . as ( null )
347- ] ) ;
348- } ) ;
349- } ) ;
350- } ) . then ( ( ) => void 0 , ( ) => void 0 ) ;
351- }
352-
353- return TPromise . as ( null ) ;
354- }
355-
356327 private initServices ( machineId : string ) : IInstantiationService {
357328 const services = new ServiceCollection ( ) ;
358329
0 commit comments