Esempio n. 1
0
    public string Dir_Relative;                    //相对路径,例如"assets\\streamingassets\\apple\\assets\\resources\\prefabs"
    #endregion
    public ABPInfo(string name, string extName, string path = "", bool bFindPath = false, string relativePath = "", bool bFindRelativePath = false)
    {
        name         = AssetBundleSettingHelper.PathToPlatformFormat(name.ToLower());
        path         = AssetBundleSettingHelper.PathToPlatformFormat(path.ToLower());
        relativePath = AssetBundleSettingHelper.PathToPlatformFormat(relativePath.ToLower());

        ExtName = extName.ToLower();;
        string tmpRP = "";

        if (!name.Equals(""))
        {
            //name中可能自己就带有路径,所以要剥离出来
            char slash = AssetBundleSettingHelper.GetSlash();
            int  idxLS = name.LastIndexOf(slash);
            if (idxLS > 0)
            {
                //名字里包含路径
                tmpRP = name.Substring(0, idxLS);
                Name  = name.Substring(idxLS + 1);
            }
            else
            {
                Name = name;
            }
            //名字最末端如果正是扩展名,那么把它干掉,所以一定不能出现连续相同扩展名在结尾,如XXXXX.assetbundle.assetbundle
            if (!ExtName.Equals(""))
            {
                if (Name.EndsWith(ExtName))
                {
                    Name = Name.Substring(0, Name.Length - ExtName.Length);
                }
            }
            NameWithExt = Name + ExtName;
        }

        AssetName = name;
        if (!AssetName.Equals(""))
        {
            if (AssetName.EndsWith(ExtName))
            {
                AssetName = AssetName.Substring(0, AssetName.Length - ExtName.Length);
            }
            DependencyName = AssetName + ExtName;
        }

        if (!path.Equals("") || bFindPath)
        {
            SetPath(Path.Combine(path, tmpRP));
        }
        else if (!relativePath.Equals("") || bFindRelativePath)
        {
            SetRelativePath(Path.Combine(relativePath, tmpRP));
        }



        CaseToLower();
    }
    public static void OpenCurPDFolder()
    {
        var absh     = GetABSH();
        var manifest = absh.GetCurPlatformManifestPath();

        if (Directory.Exists(manifest.Dir_Full))
        {
            EditorUtility.RevealInFinder(manifest.FullName);
            return;
        }

        //如果这个目录不存在,那么只能打开上层目录,如果还不存在,打个错误提示窗口吧
        string lastFolder = manifest.Dir_Full.Substring(0, manifest.Dir_Full.LastIndexOf(AssetBundleSettingHelper.GetSlash()));
        string lastName   = Path.Combine(lastFolder, "sdfsdfsd");

        if (Directory.Exists(lastFolder))
        {
            EditorUtility.RevealInFinder(lastFolder);
            return;
        }
        Debug.LogError("dddddddddddddddddddddd");
    }