Skip to content

Commit

Permalink
Create New Project: fix invalid AIR application ID
Browse files Browse the repository at this point in the history
Convert _ to -. Then, remove all invalid characters.
  • Loading branch information
joshtynjala committed Feb 6, 2024
1 parent cd09dfb commit 1e37818
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion vscode-extension/src/main/ts/commands/createNewProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,18 @@ async function createNewProjectAtUri(
const descriptorTemplatePath = sdkPath
? path.resolve(sdkPath, "templates/air/descriptor-template.xml")
: undefined;
let applicationId = mainClassName
.replace(/_/g, "-")
.replace(/[^A-Za-z0-9\-\.]/g, "");
if (applicationId.length == 0) {
// if we replaced every single character, fall back to MyApplication
applicationId = "MyApplication";
}
const airDescriptorContents = createAirDescriptor(
descriptorTemplatePath,
projectType,
swfFileName,
mainClassName,
applicationId,
mainClassName
);
if (airDescriptorContents) {
Expand Down

0 comments on commit 1e37818

Please sign in to comment.