Follow ups to initial proof-of-concept here: #489
function loadSetting(setting: ISettingRegistry.ISettings): void {
const previousDirectory = widgetConfig.config.defaultDirectory;
const currentDirectory = setting.get('defaultDirectory').composite as string;
// (1) delete the old default directory if it's empty and changed
if (drive && previousDirectory && previousDirectory !== currentDirectory) {
app.serviceManager.contents.get(previousDirectory).then(contentModel => {
if (contentModel.content.length === 0) {
app.serviceManager.contents.delete(previousDirectory).catch(() => {});
}
});
}
// (2) create the new default directory if it doesn't exist
let directoryCreation: Promise<Contents.IModel | null> = Promise.resolve(null);
if (drive && currentDirectory && previousDirectory !== currentDirectory) {
directoryCreation = app.serviceManager.contents
.get(currentDirectory, { content: false })
.catch(async () => { /* newUntitled('directory') + rename to currentDirectory */ });
}
// config is always updated, regardless of `drive`
directoryCreation.then(() => {
widgetConfig.config = { /* ...settings..., defaultDirectory: currentDirectory */ };
});
}
Follow ups to initial proof-of-concept here: #489
Test the behavior of what happens if RTC lab extensions enabled but RTC server extensions disabled. Should RTC packages automatically disable their lab extensions if their corresponding server extensions are not enabled? I think so.
Check what we should do about
!!drivev.s.collaborativechecks since they may be different based on previous point. Some areas of the code still are gated behind!!drive. Can we remove all of them now that lab extension is compatible without the drive?