1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-09 10:05:24 +02:00

Bug 158538 - fixed filetype parsing for mac os and other unix systems that support blanks in file names and someimes don't return colon delimited types from the file command.

This commit is contained in:
David Dykstal 2006-09-25 16:59:50 +00:00
parent 675ec536ee
commit 1069f7dc3d

View file

@ -151,7 +151,7 @@ public class SystemFileClassifier {
String args[] = new String[3]; String args[] = new String[3];
args[0] = "sh"; args[0] = "sh";
args[1] = "-c"; args[1] = "-c";
args[2] = "file " + absolutePath; args[2] = "file \"" + absolutePath + "\"";
BufferedReader poutReader = null; BufferedReader poutReader = null;
@ -205,14 +205,15 @@ public class SystemFileClassifier {
// default type // default type
String type = "file"; String type = "file";
// look for colon String name = line;
String fulltype = "";
// Look for colon. Name appears before colon. Full type appears after the colon
int colon = line.indexOf(':'); int colon = line.indexOf(':');
if (colon >= 0) {
// name appears before colon name = line.substring(0, colon);
String name = line.substring(0, colon); fulltype = line.substring(colon + 1, line.length()).trim();
}
// the full type appears after the colon
String fulltype = line.substring(colon + 1, line.length()).trim();
// if it is a *.class file, then we look for main method and qulaified class name // if it is a *.class file, then we look for main method and qulaified class name
// as part of the classification // as part of the classification