mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 21:49:59 +02:00
Added workspaces migration system
This commit is contained in:
parent
a4a77f4dc0
commit
1ed9227c01
2 changed files with 14 additions and 1 deletions
|
@ -234,7 +234,7 @@ var ZenWorkspaces = new class extends ZenMultiWindowFeature {
|
|||
}
|
||||
|
||||
workspaceHasIcon(workspace) {
|
||||
return typeof workspace.icon !== 'undefined' && workspace.icon !== '';
|
||||
return workspace.icon && workspace.icon !== '';
|
||||
}
|
||||
|
||||
getWorkspaceIcon(workspace) {
|
||||
|
|
|
@ -19,6 +19,19 @@ var ZenWorkspacesStorage = {
|
|||
)
|
||||
`);
|
||||
});
|
||||
await this._migrateWorkspacesFromJSON();
|
||||
},
|
||||
|
||||
async _migrateWorkspacesFromJSON() {
|
||||
const oldWorkspacesPath = PathUtils.join(PathUtils.profileDir, 'zen-workspaces', 'Workspaces.json');
|
||||
if (await IOUtils.exists(oldWorkspacesPath)) {
|
||||
console.info('ZenWorkspacesStorage: Migrating workspaces from JSON...');
|
||||
const oldWorkspaces = await IOUtils.readJSON(oldWorkspacesPath);
|
||||
for (const workspace of oldWorkspaces.workspaces) {
|
||||
await this.saveWorkspace(workspace);
|
||||
}
|
||||
await IOUtils.remove(oldWorkspacesPath);
|
||||
}
|
||||
},
|
||||
|
||||
async saveWorkspace(workspace) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue