From 245616ef1ecfcc5b7f7bf3fc00dd9f9bd3571c1c Mon Sep 17 00:00:00 2001 From: leilzh Date: Tue, 23 Mar 2021 19:40:52 +0800 Subject: [PATCH] fix: unify runtime path from ejecting --- Composer/packages/server/src/models/bot/botProject.ts | 7 ++++++- extensions/runtimes/src/index.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Composer/packages/server/src/models/bot/botProject.ts b/Composer/packages/server/src/models/bot/botProject.ts index 9904623cc6..37b50dc8bb 100644 --- a/Composer/packages/server/src/models/bot/botProject.ts +++ b/Composer/packages/server/src/models/bot/botProject.ts @@ -48,6 +48,8 @@ const oauthInput = () => ({ const defaultLanguage = 'en-us'; // default value for settings.defaultLanguage +const isUsingAdaptiveRuntime = (runtime?: DialogSetting['runtime']): boolean => + runtime?.key === 'csharp-azurewebapp-v2' || runtime?.key === 'adaptive-runtime-dotnet-webapp'; export class BotProject implements IBotProject { public ref: LocationRef; // TODO: address need to instantiate id - perhaps do so in constructor based on Store.get(projectLocationMap) @@ -200,8 +202,11 @@ export class BotProject implements IBotProject { */ public getRuntimePath = (): string | undefined => { let runtimePath = this.settings?.runtime?.path; + if (runtimePath && !Path.isAbsolute(runtimePath)) { - runtimePath = Path.resolve(this.dir, 'settings', runtimePath); + const dir = isUsingAdaptiveRuntime(this.settings?.runtime) ? Path.resolve(this.dir, 'settings') : this.dir; + + runtimePath = Path.resolve(dir, runtimePath); } return runtimePath; }; diff --git a/extensions/runtimes/src/index.ts b/extensions/runtimes/src/index.ts index 9e798deb4d..533a0f6020 100644 --- a/extensions/runtimes/src/index.ts +++ b/extensions/runtimes/src/index.ts @@ -165,7 +165,7 @@ export default async (composer: any): Promise => { await copyDir(schemaSrcPath, localDisk, schemaDstPath, project.fileStorage, pathsToExclude); const schemaFolderInRuntime = path.join(destPath, 'azurewebapp/Schemas'); await removeDirAndFiles(schemaFolderInRuntime); - return path.relative(path.join(project.dir, 'settings'), destPath); + return path.relative(project.dir, destPath); } throw new Error(`Runtime already exists at ${destPath}`); },