Skip to content

Commit

Permalink
Detection policy for Mac SVN in Moonshine updated #31
Browse files Browse the repository at this point in the history
  • Loading branch information
rat-moonshine committed Feb 23, 2022
1 parent 232db8b commit 06cc8c2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 30 deletions.
32 changes: 10 additions & 22 deletions InstallerSharedCore/src/actionScripts/managers/DetectionManager.as
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,14 @@ package actionScripts.managers
var svnDefaultPaths:Array = ["/usr/local/bin", "/opt/local/bin"];
for each(var svnPath:String in svnDefaultPaths)
{
item.isAlreadyDownloaded = HelperUtils.isValidExecutableBy(
item.installToPath = HelperUtils.isValidExecutableBy(
item.type,
svnPath,
item.pathValidation
);
item.isAlreadyDownloaded = item.installToPath != null;
if (item.isAlreadyDownloaded)
{
item.installToPath = haxeDefaultPath;
break;
}
}
Expand All @@ -300,53 +300,41 @@ package actionScripts.managers
break;
case ComponentTypes.TYPE_HAXE:
var haxeDefaultPath:String = HelperConstants.IS_MACOS ? "/usr/local/lib/haxe" : "c:\\HaxeToolkit\\haxe";
item.isAlreadyDownloaded = HelperUtils.isValidExecutableBy(
item.installToPath = HelperUtils.isValidExecutableBy(
item.type,
haxeDefaultPath,
item.pathValidation
);
if (item.isAlreadyDownloaded)
{
item.installToPath = haxeDefaultPath;
}
item.isAlreadyDownloaded = item.installToPath != null;
break;
case ComponentTypes.TYPE_NEKO:
var nekoDefaultPath:String = HelperConstants.IS_MACOS ? "/usr/local/lib/neko" : "c:\\HaxeToolkit\\neko";
item.isAlreadyDownloaded = HelperUtils.isValidExecutableBy(
item.installToPath = HelperUtils.isValidExecutableBy(
item.type,
nekoDefaultPath,
item.pathValidation
);
if (item.isAlreadyDownloaded)
{
item.installToPath = nekoDefaultPath;
}
item.isAlreadyDownloaded = item.installToPath != null;
break;
case ComponentTypes.TYPE_VAGRANT:
var vagrantDefaultPath:String = HelperConstants.IS_MACOS ? "/usr/local/bin" : "C:\\HashiCorp\\Vagrant";
item.isAlreadyDownloaded = HelperUtils.isValidExecutableBy(
item.installToPath = HelperUtils.isValidExecutableBy(
item.type,
vagrantDefaultPath,
item.pathValidation
);
if (item.isAlreadyDownloaded)
{
item.installToPath = vagrantDefaultPath;
}
item.isAlreadyDownloaded = item.installToPath != null;
break;
case ComponentTypes.TYPE_MACPORTS:
if (HelperConstants.IS_MACOS)
{
var macPortsDefaultPath:String = "/opt/local/bin";
item.isAlreadyDownloaded = HelperUtils.isValidExecutableBy(
item.installToPath = HelperUtils.isValidExecutableBy(
item.type,
macPortsDefaultPath,
item.pathValidation
);
if (item.isAlreadyDownloaded)
{
item.installToPath = macPortsDefaultPath;
}
item.isAlreadyDownloaded = item.installToPath != null;
}
break;
}
Expand Down
17 changes: 9 additions & 8 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):Boolean
public static function isValidExecutableBy(type:String, originPath:String, validationPath:Array=null):String
{
var pathValidationFileName:String;
if (FileUtils.isPathExists(originPath))
Expand All @@ -160,7 +160,7 @@ package actionScripts.utils
(type == ComponentTypes.TYPE_GIT) &&
!isGitSVNSpecialPathCheckPass(originPath))
{
return false;
return null;
}

// file-system check inside the named-sdk
Expand All @@ -174,30 +174,31 @@ package actionScripts.utils
pathValidationFileName = FileUtils.normalizePath(path);

// SDKs which validates based on *_HOME way
if (type != ComponentTypes.TYPE_GIT)
if ((type != ComponentTypes.TYPE_GIT) && (type != ComponentTypes.TYPE_SVN))
{
if (FileUtils.isPathExists(originPath + File.separator + pathValidationFileName))
var fullPath:String = originPath + File.separator + pathValidationFileName;
if (FileUtils.isPathExists(fullPath))
{
return true;
return fullPath;
}
}
else
{
if (originPath.toLowerCase().indexOf(pathValidationFileName.toLowerCase()) != -1)
{
return true;
return originPath;
}
}
}
}
}
else
{
return true;
return originPath;
}
}

return false;
return null;
}

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

0 comments on commit 06cc8c2

Please sign in to comment.