From 88a602a39d9e8f6872b65c310b4c6c83028f074b Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 4 Aug 2004 13:50:41 +0000 Subject: platform neutral path handling. --- .../internal/compiler/lookup/AjLookupEnvironment.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'org.aspectj.ajdt.core') diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index 6612e66ce..b4acd55be 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -373,18 +373,27 @@ public class AjLookupEnvironment extends LookupEnvironment { private void reportDeclareParentsMessage(WeaveMessage.WeaveMessageKind wmk,SourceTypeBinding sourceType,ResolvedTypeX parent) { if (!factory.getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { String filename = new String(sourceType.getFileName()); - if (filename.lastIndexOf(File.separator)!=-1) - filename = filename.substring(filename.lastIndexOf(File.separator)+1); + + int takefrom = filename.lastIndexOf('/'); + if (takefrom == -1 ) takefrom = filename.lastIndexOf('\\'); + filename = filename.substring(takefrom+1); factory.getWorld().getMessageHandler().handleMessage( WeaveMessage.constructWeavingMessage(wmk, new String[]{CharOperation.toString(sourceType.compoundName), filename, parent.getClassName(), - parent.getSourceLocation().getSourceFile().getName()})); + getShortname(parent.getSourceLocation().getSourceFile().getPath())})); } } - + + private String getShortname(String path) { + int takefrom = path.lastIndexOf('/'); + if (takefrom == -1) { + takefrom = path.lastIndexOf('\\'); + } + return path.substring(takefrom+1); + } private void addParent(SourceTypeBinding sourceType, ResolvedTypeX parent) { ReferenceBinding parentBinding = (ReferenceBinding)factory.makeTypeBinding(parent); -- cgit v1.2.3