using System.Collections.Generic;
using System.IO;
namespace ET
{
public class EditorResHelper
{
///
/// 获取文件夹内所有的预制跟场景路径
///
/// 源文件夹
/// 是否获取子文件夹
///
public static List GetPrefabsAndScenes(string srcPath)
{
List paths = new List();
FileHelper.GetAllFiles(paths, srcPath);
List files = new List();
foreach (string str in paths)
{
if (str.EndsWith(".prefab") || str.EndsWith(".unity"))
{
files.Add(str);
}
}
return files;
}
///
/// 获取文件夹内所有资源路径
///
/// 源文件夹
/// 是否获取子文件夹
///
public static List GetAllResourcePath(string srcPath, bool subDire)
{
List paths = new List();
string[] files = Directory.GetFiles(srcPath);
foreach (string str in files)
{
if (str.EndsWith(".meta"))
{
continue;
}
paths.Add(str);
}
if (subDire)
{
foreach (string subPath in Directory.GetDirectories(srcPath))
{
List subFiles = GetAllResourcePath(subPath, true);
paths.AddRange(subFiles);
}
}
return paths;
}
}
}