internal static bool ValidateLocationPathNameForBuildTargetGroup(string locationPathName, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options, out string errorMessage)
{
if (string.IsNullOrEmpty(locationPathName))
{
var willInstallInBuildFolder = (options & BuildOptions.InstallInBuildFolder) != 0 &&
PostprocessBuildPlayer.SupportsInstallInBuildFolder(buildTargetGroup, target);
if (!willInstallInBuildFolder)
{
errorMessage =
"The 'locationPathName' parameter for BuildPipeline.BuildPlayer should not be null or empty.";
return(false);
}
}
else if (string.IsNullOrEmpty(Path.GetFileName(locationPathName)))
{
var extensionForBuildTarget = PostprocessBuildPlayer.GetExtensionForBuildTarget(buildTargetGroup, target, options);
if (!string.IsNullOrEmpty(extensionForBuildTarget))
{
errorMessage = string.Format(
"For the '{0}' target the 'locationPathName' parameter for BuildPipeline.BuildPlayer should not end with a directory separator.\n" +
"Provided path: '{1}', expected a path with the extension '.{2}'.", target, locationPathName,
extensionForBuildTarget);
return(false);
}
}
errorMessage = "";
return(true);
}