Skip to content

Commit

Permalink
fix: unify runtime path from ejecting
Browse files Browse the repository at this point in the history
  • Loading branch information
lei9444 committed Mar 23, 2021
1 parent 294514f commit 245616e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Composer/packages/server/src/models/bot/botProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion extensions/runtimes/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default async (composer: any): Promise<void> => {
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}`);
},
Expand Down

0 comments on commit 245616e

Please sign in to comment.