GetBaseFolders() public static method

public static GetBaseFolders ( string folders ) : string[]
folders string
return string[]
Example #1
0
        void SearchInFolders(HierarchyProperty property)
        {
            List <FilterResult> list = new List <FilterResult>();

            string[] baseFolders = ProjectWindowUtil.GetBaseFolders(m_SearchFilter.folders);

            foreach (string folderPath in baseFolders)
            {
                // Ensure we do not have a filter when finding folder
                property.SetSearchFilter(new SearchFilter());

                int folderInstanceID = AssetDatabase.GetMainAssetInstanceID(folderPath);
                if (property.Find(folderInstanceID, null))
                {
                    // Set filter after we found the folder
                    property.SetSearchFilter(m_SearchFilter);
                    int   folderDepth = property.depth;
                    int[] expanded    = null; // enter all children of folder
                    while (property.NextWithDepthCheck(expanded, folderDepth + 1))
                    {
                        FilterResult result = new FilterResult();
                        CopyPropertyData(ref result, property);
                        list.Add(result);
                    }
                }
            }
            m_Results = list.ToArray();
        }
Example #2
0
        private void SearchInFolders(HierarchyProperty property)
        {
            List <FilteredHierarchy.FilterResult> list = new List <FilteredHierarchy.FilterResult>();

            string[] baseFolders = ProjectWindowUtil.GetBaseFolders(this.m_SearchFilter.folders);
            string[] array       = baseFolders;
            for (int i = 0; i < array.Length; i++)
            {
                string assetPath = array[i];
                property.SetSearchFilter(new SearchFilter());
                int mainAssetInstanceID = AssetDatabase.GetMainAssetInstanceID(assetPath);
                if (property.Find(mainAssetInstanceID, null))
                {
                    property.SetSearchFilter(this.m_SearchFilter);
                    int   depth    = property.depth;
                    int[] expanded = null;
                    while (property.NextWithDepthCheck(expanded, depth + 1))
                    {
                        FilteredHierarchy.FilterResult item = new FilteredHierarchy.FilterResult();
                        this.CopyPropertyData(ref item, property);
                        list.Add(item);
                    }
                }
            }
            this.m_Results = list.ToArray();
        }
        void SearchInFolders()
        {
            List <FilterResult> list        = new List <FilterResult>();
            List <string>       baseFolders = new List <string>();

            baseFolders.AddRange(ProjectWindowUtil.GetBaseFolders(m_SearchFilter.folders));
            if (baseFolders.Remove(PackageManager.Folders.GetPackagesMountPoint()))
            {
                var packages = PackageManager.Packages.GetAll();
                foreach (var package in packages)
                {
                    if (package.source == PackageManager.PackageSource.BuiltIn)
                    {
                        continue;
                    }

                    if (!baseFolders.Contains(package.assetPath))
                    {
                        baseFolders.Add(package.assetPath);
                    }
                }
            }

            m_SearchFilter.searchArea = SearchFilter.SearchArea.SelectedFolders;
            foreach (string folderPath in baseFolders)
            {
                // Ensure we do not have a filter when finding folder
                HierarchyProperty property = new HierarchyProperty(folderPath);
                property.SetSearchFilter(m_SearchFilter);

                // Set filter after we found the folder
                int   folderDepth = property.depth;
                int[] expanded    = null; // enter all children of folder
                while (property.NextWithDepthCheck(expanded, folderDepth + 1))
                {
                    FilterResult result = new FilterResult();
                    CopyPropertyData(ref result, property);
                    list.Add(result);
                }
            }
            m_Results = list.ToArray();
        }
Example #4
0
        private void SearchInFolders(HierarchyProperty property)
        {
            List <FilteredHierarchy.FilterResult> filterResultList = new List <FilteredHierarchy.FilterResult>();

            foreach (string baseFolder in ProjectWindowUtil.GetBaseFolders(this.m_SearchFilter.folders))
            {
                property.SetSearchFilter(new SearchFilter());
                int mainAssetInstanceId = AssetDatabase.GetMainAssetInstanceID(baseFolder);
                if (property.Find(mainAssetInstanceId, (int[])null))
                {
                    property.SetSearchFilter(this.m_SearchFilter);
                    int   depth    = property.depth;
                    int[] expanded = (int[])null;
                    while (property.NextWithDepthCheck(expanded, depth + 1))
                    {
                        FilteredHierarchy.FilterResult result = new FilteredHierarchy.FilterResult();
                        this.CopyPropertyData(ref result, property);
                        filterResultList.Add(result);
                    }
                }
            }
            this.m_Results = filterResultList.ToArray();
        }