From: woojin Date: Wed, 22 Oct 2014 00:51:53 +0000 (+0900) Subject: FUNCTION: bug fix of source link on platform project X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F73%2F29173%2F1;p=sdk%2Ftools%2Fdynamic-analyzer.git FUNCTION: bug fix of source link on platform project bug fix - enable source link on platform project findFileRecursive function now finds directory too Change-Id: I73072f28eb013d43a93650f10440131ec6862e34 Signed-off-by: woojin --- diff --git a/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/FileUtil.java b/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/FileUtil.java index 5d8fd04..d9099d0 100644 --- a/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/FileUtil.java +++ b/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/FileUtil.java @@ -186,18 +186,24 @@ public class FileUtil { } private static void findFileRecursive(File rootPath, String regex, boolean recursive, - List result) throws FileNotFoundException, IOException { + boolean isFile, List result) throws FileNotFoundException, IOException { File[] filesAndDirs = rootPath.listFiles(); if (null == filesAndDirs) { // if rootPath is not a directory return; } for (File file : filesAndDirs) { - if (file.isFile() && file.getName().matches(regex)) { - result.add(file.getCanonicalPath()); // add to result if it's - // file - } else if (recursive) { - findFileRecursive(file, regex, recursive, result); // recursive + if (file.isFile()) { // file + if (isFile && file.getName().matches(regex)) { + result.add(file.getCanonicalPath()); // add to result if it's file + } + } else { // directory + if (!isFile && file.getName().matches(regex)) { + result.add(file.getCanonicalPath()); + } + if (recursive) { + findFileRecursive(file, regex, recursive, isFile, result); // recursive + } } } } @@ -212,14 +218,14 @@ public class FileUtil { * glob pattern of file name * @return canonical file path list */ - public static List findFilesInDir(String dirPath, String fileToken) { + public static List findFilesInDir(String dirPath, String fileToken, boolean isFile) { List resultFiles = new ArrayList(); String regex = convertGlobToRegex(fileToken); File startingDir = new File(dirPath); if (startingDir.exists()) { try { - findFileRecursive(startingDir, regex, true, resultFiles); + findFileRecursive(startingDir, regex, true, isFile, resultFiles); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java index e407ab2..4124449 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java @@ -239,7 +239,7 @@ public class AppInfo { // check debuginfo file path if (debugInfoRpmFile.getName().contains(RpmUtil.DEBUGINFO)) { - List files = FileUtil.findFilesInDir(rpmPath, getExecFileName() + ".debug"); + List files = FileUtil.findFilesInDir(rpmPath, getExecFileName() + ".debug", true); if (files.size() == 0) { return; } else { @@ -248,7 +248,7 @@ public class AppInfo { } // future extension for applications with normal debug package } else if (debugInfoRpmFile.getName().contains(RpmUtil.DEBUG)) { - List files = FileUtil.findFilesInDir(rpmPath, getExecFileName()); + List files = FileUtil.findFilesInDir(rpmPath, getExecFileName(), true); if (files.size() == 0) { return; } else { @@ -313,7 +313,7 @@ public class AppInfo { // check debugsource file path List files = FileUtil.findFilesInDir(rpmPath, projectName - + CommonConstants.ASTERISK); + + CommonConstants.ASTERISK, false); if (files.size() != 0) { setSourcePath(rpmPath); Logger.debug("SOURCE PATH : " + properties.get(PROPERTY.SRCPATH.index)); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingManager.java index c6596e7..e0bc9c4 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingManager.java @@ -212,7 +212,7 @@ public class BinarySettingManager { if (debugRpmPath.contains(RpmUtil.DEBUGINFO)) { // find real debug file String debugCandidate = "*" + binName + ".debug"; - List debugfilelist = FileUtil.findFilesInDir(extractPath, debugCandidate); + List debugfilelist = FileUtil.findFilesInDir(extractPath, debugCandidate, true); if (debugfilelist.size() > 0) { binData.setDebugFilePath(debugfilelist.get(0)); @@ -228,7 +228,7 @@ public class BinarySettingManager { binData.setDebugFilePath(null); } } else if (debugRpmPath.contains(RpmUtil.DEBUG)) { - List debugfilelist = FileUtil.findFilesInDir(extractPath, binName); + List debugfilelist = FileUtil.findFilesInDir(extractPath, binName, true); if (debugfilelist.size() > 0) { binData.setDebugFilePath(debugfilelist.get(0)); } else { @@ -263,7 +263,7 @@ public class BinarySettingManager { rootPath = rootPath + File.separator; } - List rpmlist = FileUtil.findFilesInDir(rootPath, token); + List rpmlist = FileUtil.findFilesInDir(rootPath, token, true); if (binName != null) { // get file list in rpm package and find target binary name