]> source.dussan.org Git - aspectj.git/commitdiff
platform neutral path handling.
authoraclement <aclement>
Wed, 4 Aug 2004 13:50:41 +0000 (13:50 +0000)
committeraclement <aclement>
Wed, 4 Aug 2004 13:50:41 +0000 (13:50 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java

index 6612e66cede74141d387c699f92e99aa2d177c0c..b4acd55be431d5f15c5a4d71813d6a98dcaaee41 100644 (file)
@@ -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); 
index 4d031bcb99a467c7dfc30ecb50236d975dc1180f..f64d91c06e726c8e68ab94ed91af6e02a8747e41 100644 (file)
@@ -98,7 +98,8 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
                if (worthReporting  && munger!=null && !weaver.getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) {
                        String tName = weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getName();
                        if (tName.indexOf("no debug info available")!=-1) tName = "no debug info available";
-                       String fName = getAspectType().getSourceLocation().getSourceFile().getName();
+                       else tName = getShortname(weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getPath());
+                       String fName = getShortname(getAspectType().getSourceLocation().getSourceFile().getPath());
                if (munger.getKind().equals(ResolvedTypeMunger.Parent)) {
                        // This message will come out of AjLookupEnvironment.addParent if doing a source
                        // compilation.
@@ -122,6 +123,14 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
                
                return changed;
        }
+       
+       private String getShortname(String path)  {
+               int takefrom = path.lastIndexOf('/');
+               if (takefrom == -1) {
+                       takefrom = path.lastIndexOf('\\');
+               }
+               return path.substring(takefrom+1);
+       }
 
 
        private boolean mungeNewParent(BcelClassWeaver weaver, NewParentTypeMunger munger) {