From 1069f7dc3dbbf819d91bb654a2d58cacdd8f90f5 Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Mon, 25 Sep 2006 16:59:50 +0000 Subject: [PATCH] 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. --- .../clientserver/SystemFileClassifier.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemFileClassifier.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemFileClassifier.java index cc7a28f0237..50470a3efec 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemFileClassifier.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemFileClassifier.java @@ -151,7 +151,7 @@ public class SystemFileClassifier { String args[] = new String[3]; args[0] = "sh"; args[1] = "-c"; - args[2] = "file " + absolutePath; + args[2] = "file \"" + absolutePath + "\""; BufferedReader poutReader = null; @@ -205,14 +205,15 @@ public class SystemFileClassifier { // default type 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(':'); - - // name appears before colon - String name = line.substring(0, colon); - - // the full type appears after the colon - String fulltype = line.substring(colon + 1, line.length()).trim(); + if (colon >= 0) { + name = line.substring(0, colon); + fulltype = line.substring(colon + 1, line.length()).trim(); + } // if it is a *.class file, then we look for main method and qulaified class name // as part of the classification