Skip to content

Commit

Permalink
Re-fixing broken SDK-detection ways #31
Browse files Browse the repository at this point in the history
  • Loading branch information
rat-moonshine committed Feb 24, 2022
1 parent 06cc8c2 commit 6b033cb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
34 changes: 23 additions & 11 deletions InstallerSharedCore/src/actionScripts/managers/DetectionManager.as
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,17 @@ package actionScripts.managers
case ComponentTypes.TYPE_SVN:
if (HelperConstants.IS_MACOS)
{
var svnDefaultPaths:Array = ["/usr/local/bin", "/opt/local/bin"];
var svnDefaultPaths:Array = ["/usr/local/bin/svn", "/opt/local/bin/svn"];
for each(var svnPath:String in svnDefaultPaths)
{
item.installToPath = HelperUtils.isValidExecutableBy(
item.isAlreadyDownloaded = HelperUtils.isValidExecutableBy(
item.type,
svnPath,
item.pathValidation
);
item.isAlreadyDownloaded = item.installToPath != null;
if (item.isAlreadyDownloaded)
{
item.installToPath = svnPath;
break;
}
}
Expand All @@ -300,41 +300,53 @@ package actionScripts.managers
break;
case ComponentTypes.TYPE_HAXE:
var haxeDefaultPath:String = HelperConstants.IS_MACOS ? "/usr/local/lib/haxe" : "c:\\HaxeToolkit\\haxe";
item.installToPath = HelperUtils.isValidExecutableBy(
item.isAlreadyDownloaded = HelperUtils.isValidExecutableBy(
item.type,
haxeDefaultPath,
item.pathValidation
);
item.isAlreadyDownloaded = item.installToPath != null;
if (item.isAlreadyDownloaded)
{
item.installToPath = haxeDefaultPath;
}
break;
case ComponentTypes.TYPE_NEKO:
var nekoDefaultPath:String = HelperConstants.IS_MACOS ? "/usr/local/lib/neko" : "c:\\HaxeToolkit\\neko";
item.installToPath = HelperUtils.isValidExecutableBy(
item.isAlreadyDownloaded = HelperUtils.isValidExecutableBy(
item.type,
nekoDefaultPath,
item.pathValidation
);
item.isAlreadyDownloaded = item.installToPath != null;
if (item.isAlreadyDownloaded)
{
item.installToPath = nekoDefaultPath;
}
break;
case ComponentTypes.TYPE_VAGRANT:
var vagrantDefaultPath:String = HelperConstants.IS_MACOS ? "/usr/local/bin" : "C:\\HashiCorp\\Vagrant";
item.installToPath = HelperUtils.isValidExecutableBy(
item.isAlreadyDownloaded = HelperUtils.isValidExecutableBy(
item.type,
vagrantDefaultPath,
item.pathValidation
);
item.isAlreadyDownloaded = item.installToPath != null;
if (item.isAlreadyDownloaded)
{
item.installToPath = vagrantDefaultPath;
}
break;
case ComponentTypes.TYPE_MACPORTS:
if (HelperConstants.IS_MACOS)
{
var macPortsDefaultPath:String = "/opt/local/bin";
item.installToPath = HelperUtils.isValidExecutableBy(
item.isAlreadyDownloaded = HelperUtils.isValidExecutableBy(
item.type,
macPortsDefaultPath,
item.pathValidation
);
item.isAlreadyDownloaded = item.installToPath != null;
if (item.isAlreadyDownloaded)
{
item.installToPath = macPortsDefaultPath;
}
}
break;
}
Expand Down
12 changes: 6 additions & 6 deletions InstallerSharedCore/src/actionScripts/utils/HelperUtils.as
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ package actionScripts.utils
return false;
}

public static function isValidExecutableBy(type:String, originPath:String, validationPath:Array=null):String
public static function isValidExecutableBy(type:String, originPath:String, validationPath:Array=null):Boolean
{
var pathValidationFileName:String;
if (FileUtils.isPathExists(originPath))
Expand All @@ -160,7 +160,7 @@ package actionScripts.utils
(type == ComponentTypes.TYPE_GIT) &&
!isGitSVNSpecialPathCheckPass(originPath))
{
return null;
return false;
}

// file-system check inside the named-sdk
Expand All @@ -179,26 +179,26 @@ package actionScripts.utils
var fullPath:String = originPath + File.separator + pathValidationFileName;
if (FileUtils.isPathExists(fullPath))
{
return fullPath;
return true;
}
}
else
{
if (originPath.toLowerCase().indexOf(pathValidationFileName.toLowerCase()) != -1)
{
return originPath;
return true;
}
}
}
}
}
else
{
return originPath;
return true;
}
}

return null;
return false;
}

public static function updatePathWithCustomWindows(path:String):void
Expand Down

0 comments on commit 6b033cb

Please sign in to comment.