提交 eb2a8e12 编写于 作者: D Daniel Imms

Fix some empty workspace edge cases on Mac

上级 30bb0b77
......@@ -632,6 +632,9 @@ export class WindowsManager implements IWindowsService {
});
// Get rid of duplicates
iPathsToOpen = arrays.distinct(iPathsToOpen, path => {
if (!('workspacePath' in path)) {
return path.workspacePath;
}
return platform.isLinux ? path.workspacePath : path.workspacePath.toLowerCase();
});
}
......@@ -764,8 +767,8 @@ export class WindowsManager implements IWindowsService {
// Emit events
iPathsToOpen.forEach(iPath => this.eventEmitter.emit(EventTypes.OPEN, iPath));
// Add to backups
this.backupService.pushWorkspaceBackupPathsSync(iPathsToOpen.map((path) => {
// Start tracking workspace backups
this.backupService.pushWorkspaceBackupPathsSync(iPathsToOpen.filter(path => 'workspacePath' in path).map(path => {
return Uri.file(path.workspacePath);
}));
......
......@@ -117,7 +117,7 @@ export abstract class TextFileService implements ITextFileService {
private beforeShutdown(): boolean | TPromise<boolean> {
// If hot exit is enabled then save the dirty files in the workspace and then exit
if (this.configuredHotExit) {
if (this.configuredHotExit && this.contextService.getWorkspace()) {
// If there are no dirty files, clean up and exit
if (this.getDirty().length === 0) {
return this.cleanupBackupsBeforeShutdown();
......@@ -190,7 +190,11 @@ export abstract class TextFileService implements ITextFileService {
}
private cleanupBackupsBeforeShutdown(): boolean | TPromise<boolean> {
return this.backupService.removeWorkspaceBackupPath(this.contextService.getWorkspace().resource).then(() => {
const workspace = this.contextService.getWorkspace();
if (!workspace) {
return TPromise.as(false); // no backups to cleanup, no eto
}
return this.backupService.removeWorkspaceBackupPath(workspace.resource).then(() => {
return this.fileService.discardBackups().then(() => {
return false; // no veto
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册