public static String getResPath(String filePath) {
File file = FileUtils.getFile(filePath);
if (!file.exists() || !file.isDirectory())
return null;
File[] list = file.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
if (dir.isDirectory() && "res".equals(name))
return true;
return false;
}
});
if (list != null && list.length > 0) {
return list[0].getAbsolutePath();
}
File[] list2 = file.listFiles();
if(list2!=null)
for (File innerFilePath : list2) {
String resPath = getResPath(innerFilePath.getAbsolutePath());
if (resPath != null) {
return resPath;
}
}
return null;
}
获取文件夹为res的路径