AssetBundleGraph.FileUtility.GetAllFilePathsInFolder C# (CSharp) Method

GetAllFilePathsInFolder() public static method

public static GetAllFilePathsInFolder ( string localFolderPath, bool includeHidden = false, bool includeMeta = !AssetBundleGraphSettings.IGNORE_META ) : List
localFolderPath string
includeHidden bool
includeMeta bool
return List
        public static List<string> GetAllFilePathsInFolder(string localFolderPath, bool includeHidden=false, bool includeMeta=!AssetBundleGraphSettings.IGNORE_META)
        {
            var filePaths = new List<string>();

            if (string.IsNullOrEmpty(localFolderPath)) {
                return filePaths;
            }
            if (!Directory.Exists(localFolderPath)) {
                return filePaths;
            }

            GetFilePathsRecursively(localFolderPath, filePaths, includeHidden, includeMeta);

            return filePaths;
        }

Usage Example

        void Load(BuildTarget target,
                  NodeData node,
                  IEnumerable <ConnectionData> connectionsToOutput,
                  PerformGraph.Output Output)
        {
            if (connectionsToOutput == null || Output == null)
            {
                return;
            }

            // SOMEWHERE_FULLPATH/PROJECT_FOLDER/Assets/
            var assetsFolderPath = Application.dataPath + AssetBundleGraphSettings.UNITY_FOLDER_SEPARATOR;

            var outputSource    = new List <AssetReference>();
            var targetFilePaths = FileUtility.GetAllFilePathsInFolder(node.GetLoaderFullLoadPath(target));

            foreach (var targetFilePath in targetFilePaths)
            {
                if (targetFilePath.Contains(AssetBundleGraphSettings.ASSETBUNDLEGRAPH_PATH))
                {
                    continue;
                }

                // already contained into Assets/ folder.
                // imported path is Assets/SOMEWHERE_FILE_EXISTS.
                if (targetFilePath.StartsWith(assetsFolderPath))
                {
                    var relativePath = targetFilePath.Replace(assetsFolderPath, AssetBundleGraphSettings.ASSETS_PATH);

                    var r = AssetReferenceDatabase.GetReference(relativePath);

                    if (!TypeUtility.IsLoadingAsset(r))
                    {
                        continue;
                    }

                    if (r != null)
                    {
                        outputSource.Add(AssetReferenceDatabase.GetReference(relativePath));
                    }
                    continue;
                }

                throw new NodeException(node.Name + ": Invalid Load Path. Path must start with Assets/", node.Name);
            }

            var output = new Dictionary <string, List <AssetReference> > {
                { "0", outputSource }
            };

            var dst = (connectionsToOutput == null || !connectionsToOutput.Any())?
                      null : connectionsToOutput.First();

            Output(dst, output);
        }
All Usage Examples Of AssetBundleGraph.FileUtility::GetAllFilePathsInFolder