CalculateFinalPluginPath() public method

public CalculateFinalPluginPath ( string platformName, UnityEditor.PluginImporter imp ) : string
platformName string
imp UnityEditor.PluginImporter
return string
コード例 #1
0
    private void CopyNativePlugins()
    {
        string buildTargetName = BuildPipeline.GetBuildTargetName(this.m_PostProcessArgs.target);
        IPluginImporterExtension extension = new DesktopPluginImporterExtension();
        string stagingAreaPluginsFolder = this.StagingAreaPluginsFolder;
        string path = Path.Combine(stagingAreaPluginsFolder, "x86");
        string str4 = Path.Combine(stagingAreaPluginsFolder, "x86_64");
        bool flag = false;
        bool flag2 = false;
        bool flag3 = false;
        foreach (PluginImporter importer in PluginImporter.GetImporters(this.m_PostProcessArgs.target))
        {
            BuildTarget platform = this.m_PostProcessArgs.target;
            if (importer.isNativePlugin)
            {
                if (string.IsNullOrEmpty(importer.assetPath))
                {
                    Debug.LogWarning("Got empty plugin importer path for " + this.m_PostProcessArgs.target.ToString());
                    continue;
                }
                if (!flag)
                {
                    Directory.CreateDirectory(stagingAreaPluginsFolder);
                    flag = true;
                }
                bool flag4 = Directory.Exists(importer.assetPath);
                switch (importer.GetPlatformData(platform, "CPU"))
                {
                    case "x86":
                        switch (platform)
                        {
                            case BuildTarget.StandaloneOSXIntel64:
                            case BuildTarget.StandaloneWindows64:
                            case BuildTarget.StandaloneLinux64:
                            {
                                continue;
                            }
                        }
                        if (!flag2)
                        {
                            Directory.CreateDirectory(path);
                            flag2 = true;
                        }
                        break;

                    case "x86_64":
                        if ((((platform != BuildTarget.StandaloneOSXIntel64) && (platform != BuildTarget.StandaloneOSXUniversal)) && ((platform != BuildTarget.StandaloneWindows64) && (platform != BuildTarget.StandaloneLinux64))) && (platform != BuildTarget.StandaloneLinuxUniversal))
                        {
                            continue;
                        }
                        if (!flag3)
                        {
                            Directory.CreateDirectory(str4);
                            flag3 = true;
                        }
                        break;

                    case "None":
                    {
                        continue;
                    }
                }
                string str6 = extension.CalculateFinalPluginPath(buildTargetName, importer);
                if (!string.IsNullOrEmpty(str6))
                {
                    string target = Path.Combine(stagingAreaPluginsFolder, str6);
                    if (flag4)
                    {
                        FileUtil.CopyDirectoryRecursive(importer.assetPath, target);
                    }
                    else
                    {
                        FileUtil.UnityFileCopy(importer.assetPath, target);
                    }
                }
            }
        }
        foreach (PluginDesc desc in PluginImporter.GetExtensionPlugins(this.m_PostProcessArgs.target))
        {
            if (!flag)
            {
                Directory.CreateDirectory(stagingAreaPluginsFolder);
                flag = true;
            }
            string str8 = Path.Combine(stagingAreaPluginsFolder, Path.GetFileName(desc.pluginPath));
            if (!Directory.Exists(str8) && !File.Exists(str8))
            {
                if (Directory.Exists(desc.pluginPath))
                {
                    FileUtil.CopyDirectoryRecursive(desc.pluginPath, str8);
                }
                else
                {
                    FileUtil.CopyFileIfExists(desc.pluginPath, str8, false);
                }
            }
        }
    }
コード例 #2
0
	private void CopyNativePlugins()
	{
		string buildTargetName = BuildPipeline.GetBuildTargetName(this.m_PostProcessArgs.target);
		IPluginImporterExtension pluginImporterExtension = new DesktopPluginImporterExtension();
		string stagingAreaPluginsFolder = this.StagingAreaPluginsFolder;
		string path = Path.Combine(stagingAreaPluginsFolder, "x86");
		string path2 = Path.Combine(stagingAreaPluginsFolder, "x86_64");
		bool flag = false;
		bool flag2 = false;
		bool flag3 = false;
		PluginImporter[] importers = PluginImporter.GetImporters(this.m_PostProcessArgs.target);
		for (int i = 0; i < importers.Length; i++)
		{
			PluginImporter pluginImporter = importers[i];
			BuildTarget target = this.m_PostProcessArgs.target;
			if (pluginImporter.isNativePlugin)
			{
				if (string.IsNullOrEmpty(pluginImporter.assetPath))
				{
					Debug.LogWarning("Got empty plugin importer path for " + this.m_PostProcessArgs.target.ToString());
				}
				else
				{
					if (!flag)
					{
						Directory.CreateDirectory(stagingAreaPluginsFolder);
						flag = true;
					}
					bool flag4 = Directory.Exists(pluginImporter.assetPath);
					string platformData = pluginImporter.GetPlatformData(target, "CPU");
					string text = platformData;
					switch (text)
					{
					case "x86":
						if (target == BuildTarget.StandaloneOSXIntel64 || target == BuildTarget.StandaloneWindows64 || target == BuildTarget.StandaloneLinux64)
						{
							goto IL_21A;
						}
						if (!flag2)
						{
							Directory.CreateDirectory(path);
							flag2 = true;
						}
						break;
					case "x86_64":
						if (target != BuildTarget.StandaloneOSXIntel64 && target != BuildTarget.StandaloneOSXUniversal && target != BuildTarget.StandaloneWindows64 && target != BuildTarget.StandaloneLinux64 && target != BuildTarget.StandaloneLinuxUniversal)
						{
							goto IL_21A;
						}
						if (!flag3)
						{
							Directory.CreateDirectory(path2);
							flag3 = true;
						}
						break;
					case "None":
						goto IL_21A;
					}
					string text2 = Path.Combine(stagingAreaPluginsFolder, pluginImporterExtension.CalculateFinalPluginPath(buildTargetName, pluginImporter));
					if (flag4)
					{
						FileUtil.CopyDirectoryRecursive(pluginImporter.assetPath, text2);
					}
					else
					{
						FileUtil.UnityFileCopy(pluginImporter.assetPath, text2);
					}
				}
			}
			IL_21A:;
		}
	}
コード例 #3
0
 private void CopyNativePlugins()
 {
     string buildTargetName = BuildPipeline.GetBuildTargetName(this.m_PostProcessArgs.target);
     IPluginImporterExtension extension = new DesktopPluginImporterExtension();
     string stagingAreaPluginsFolder = this.StagingAreaPluginsFolder;
     string path = Path.Combine(stagingAreaPluginsFolder, "x86");
     string str4 = Path.Combine(stagingAreaPluginsFolder, "x86_64");
     bool flag = false;
     bool flag2 = false;
     bool flag3 = false;
     foreach (PluginImporter importer in PluginImporter.GetImporters(this.m_PostProcessArgs.target))
     {
         string str6;
         BuildTarget platform = this.m_PostProcessArgs.target;
         if (!importer.isNativePlugin)
         {
             continue;
         }
         if (string.IsNullOrEmpty(importer.assetPath))
         {
             Debug.LogWarning("Got empty plugin importer path for " + this.m_PostProcessArgs.target.ToString());
             continue;
         }
         if (!flag)
         {
             Directory.CreateDirectory(stagingAreaPluginsFolder);
             flag = true;
         }
         bool flag4 = Directory.Exists(importer.assetPath);
         string platformData = importer.GetPlatformData(platform, "CPU");
         if (platformData != null)
         {
             int num2;
             if (<>f__switch$map14 == null)
             {
                 Dictionary<string, int> dictionary = new Dictionary<string, int>(3);
                 dictionary.Add("x86", 0);
                 dictionary.Add("x86_64", 1);
                 dictionary.Add("None", 2);
                 <>f__switch$map14 = dictionary;
             }
             if (<>f__switch$map14.TryGetValue(platformData, out num2))
             {
                 switch (num2)
                 {
                     case 0:
                     {
                         if (((platform != BuildTarget.StandaloneOSXIntel64) && (platform != BuildTarget.StandaloneWindows64)) && (platform != BuildTarget.StandaloneLinux64))
                         {
                             goto Label_017E;
                         }
                         continue;
                     }
                     case 1:
                     {
                         switch (platform)
                         {
                             case BuildTarget.StandaloneOSXIntel64:
                             case BuildTarget.StandaloneOSXUniversal:
                             case BuildTarget.StandaloneWindows64:
                             case BuildTarget.StandaloneLinux64:
                             case BuildTarget.StandaloneLinuxUniversal:
                                 goto Label_01C5;
                         }
                         continue;
                     }
                     case 2:
                     {
                         continue;
                     }
                 }
             }
         }
         goto Label_01E1;
     Label_017E:
         if (!flag2)
         {
             Directory.CreateDirectory(path);
             flag2 = true;
         }
         goto Label_01E1;
     Label_01C5:
         if (!flag3)
         {
             Directory.CreateDirectory(str4);
             flag3 = true;
         }
     Label_01E1:
         str6 = extension.CalculateFinalPluginPath(buildTargetName, importer);
         if (!string.IsNullOrEmpty(str6))
         {
             string target = Path.Combine(stagingAreaPluginsFolder, str6);
             if (flag4)
             {
                 FileUtil.CopyDirectoryRecursive(importer.assetPath, target);
             }
             else
             {
                 FileUtil.UnityFileCopy(importer.assetPath, target);
             }
         }
     }
 }