Skip to content

Commit

Permalink
vscode-extension: set renderMode direct for Feathers SDK projects
Browse files Browse the repository at this point in the history
don't set visible if it isn't commented out

add some comments to explain the other replacements
  • Loading branch information
joshtynjala committed Jan 24, 2024
1 parent c52b6b6 commit a55de9a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion vscode-extension/src/main/ts/commands/createNewProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,24 +327,46 @@ function createAirDescriptor(
encoding: "utf8",
});
// (?!\s*-->) ignores lines that are commented out

// set <content> value, if it isn't commented out
descriptorContents = descriptorContents.replace(
/<content>.*<\/content>(?!\s*-->)/,
`<content>${swfFileName}</content>`
);
// set <id> value, if it isn't commented out
descriptorContents = descriptorContents.replace(
/<id>.*<\/id>(?!\s*-->)/,
`<id>${applicationId}</id>`
);
// set <filename> value, if it isn't commented out
descriptorContents = descriptorContents.replace(
/<filename>.*<\/filename>(?!\s*-->)/,
`<filename>${fileName}</filename>`
);
if (!projectType.flex && !projectType.royale && !projectType.feathers) {
// set <visible> to true, if it isn't already populated
// (AIR-only; other SDKs handle it automatically)
if (
!projectType.flex &&
!projectType.royale &&
!projectType.feathers &&
!/<visible>.*<\/visible>(?!\s*-->)/.test(descriptorContents)
) {
descriptorContents = descriptorContents.replace(
/<!-- <visible><\/visible> -->/,
`<visible>true</visible>`
);
}
// set <renderMode> to direct, if it isn't already populated
// (Feathers-only; not assumed for other SDKs)
if (
projectType.feathers &&
!/<renderMode>.*<\/renderMode>(?!\s*-->)/.test(descriptorContents)
) {
descriptorContents = descriptorContents.replace(
/<!-- <renderMode>.*<\/renderMode> -->/,
`<renderMode>direct</renderMode>`
);
}

return descriptorContents;
}
Expand Down

0 comments on commit a55de9a

Please sign in to comment.