Skip to content

Commit

Permalink
Fixing correct namespace value problem during -app.xml file copying i…
Browse files Browse the repository at this point in the history
…nto the bin-debug folder, during a Build & Run (#869)
  • Loading branch information
rat-moonshine committed Jun 28, 2021
1 parent 462d052 commit e18a04a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ package actionScripts.plugins.as3project.mxmlc
sdkSelectionCancelled(null);
// update swf version if a newer SDK now saved than previously saved one
AS3ProjectVO(currentProject).swfOutput.swfVersion = SDKUtils.getSdkSwfMajorVersion();
AS3ProjectVO(currentProject).swfOutput.swfMinorVersion = SDKUtils.getSdkSwfMinorVersion();
// continue with waiting build process again
proceedWithBuild(currentProject);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import flash.filesystem.File;
// replace if appropriate
data = data.replace(/<content>.*?<\/content>/, "<content>"+ project.swfOutput.path.fileBridge.name +"</content>");
data = data.replace(currentAIRNamespaceVersion, "http://ns.adobe.com/air/application/"+ (
(project.swfOutput.swfVersionStrict != 0) ? project.swfOutput.swfVersionStrict : project.swfOutput.swfVersion +".0"
(project.swfOutput.swfVersionStrict != 0) ? project.swfOutput.swfVersionStrict : project.swfOutput.swfVersion +"."+ project.swfOutput.swfMinorVersion
));
if (data.indexOf("_") != -1)
{
Expand Down
110 changes: 51 additions & 59 deletions ide/MoonshineSharedCore/src/actionScripts/utils/SDKUtils.as
Original file line number Diff line number Diff line change
Expand Up @@ -328,74 +328,66 @@ package actionScripts.utils

return null;
}

public static function getSdkSwfFullVersion(sdkPath:String=null, providerToUpdateAsync:Object=null, fieldToUpdateAsync:String=null):Number
{
var currentSDKVersion: Number = 10;
var sdk:FileLocation;
if (sdkPath)
{
var isFound:SDKReferenceVO = UtilsCore.getUserDefinedSDK(sdkPath, "path");
if (isFound) sdk = new FileLocation(isFound.path);
}
else
{
sdk = IDEModel.getInstance().defaultSDK;
}

if (sdk && sdk.fileBridge.exists)
{
var configFile:FileLocation = getSDKConfig(sdk);
if (configFile.fileBridge.exists)
{
// for async type of read and update to specific object's field
if (providerToUpdateAsync)
{
providerToUpdateAsync[fieldToUpdateAsync] = currentSDKVersion;
configFile.fileBridge.readAsync(providerToUpdateAsync, XML, int, fieldToUpdateAsync, "target-player");
}
// non-async direct return only
else
{
var tmpConfigXML: XML = XML(configFile.fileBridge.read());
currentSDKVersion = Number(tmpConfigXML["target-player"]);
}
}
}

return currentSDKVersion;
}

public static function getSdkSwfMajorVersion(sdkPath:String=null, providerToUpdateAsync:Object=null, fieldToUpdateAsync:String=null):int
{
var currentSDKVersion: int = 10;
var sdk:FileLocation;
if (sdkPath)
{
var isFound:SDKReferenceVO = UtilsCore.getUserDefinedSDK(sdkPath, "path");
if (isFound) sdk = new FileLocation(isFound.path);
}
else
{
sdk = IDEModel.getInstance().defaultSDK;
}

if (sdk && sdk.fileBridge.exists)
{
var configFile:FileLocation = getSDKConfig(sdk);
if (configFile.fileBridge.exists)
{
// for async type of read and update to specific object's field
if (providerToUpdateAsync)
{
providerToUpdateAsync[fieldToUpdateAsync] = currentSDKVersion;
configFile.fileBridge.readAsync(providerToUpdateAsync, XML, int, fieldToUpdateAsync, "target-player");
}
// non-async direct return only
else
{
var tmpConfigXML: XML = XML(configFile.fileBridge.read());
currentSDKVersion = int(tmpConfigXML["target-player"]);
}
}
}
var swfFullVersion:Number = getSdkSwfFullVersion(sdkPath, providerToUpdateAsync, fieldToUpdateAsync);
var versionParts:Array = swfFullVersion.toString().split(".");
if (versionParts.length > 1)
{
return int(versionParts[0]);
}

return currentSDKVersion;
return swfFullVersion;
}

public static function getSdkSwfMinorVersion(sdkPath:String=null):int
{
var currentSdkMinorVersion: int = 0;
var sdk:FileLocation;
if (sdkPath)
{
var isFound:SDKReferenceVO = UtilsCore.getUserDefinedSDK(sdkPath, "path");
if (isFound) sdk = new FileLocation(isFound.path);
}
else
{
sdk = IDEModel.getInstance().defaultSDK;
}

if (sdk && sdk.fileBridge.exists)
{
var configFile:FileLocation = getSDKConfig(sdk);
if (configFile.fileBridge.exists)
{
var tmpConfigXML: XML = XML(configFile.fileBridge.read());
var targetPlayerVersion:String = tmpConfigXML["target-player"].toString();
var versionParts:Array = targetPlayerVersion.split(".");
if (versionParts.length > 1)
{
currentSdkMinorVersion = int(versionParts[1]);
}
}
}
var swfFullVersion:Number = getSdkSwfFullVersion(sdkPath);
var versionParts:Array = swfFullVersion.toString().split(".");
if (versionParts.length > 1)
{
return int(versionParts[1]);
}

return currentSdkMinorVersion;
return 0;
}

public static function checkSDKTypeInSDKList(type:String):SDKReferenceVO
Expand Down

0 comments on commit e18a04a

Please sign in to comment.