]> source.dussan.org Git - aspectj.git/commitdiff
macfix: use canonicalpath in case the /tmp dir is a softlink
authoraclement <aclement>
Mon, 22 Oct 2007 08:55:47 +0000 (08:55 +0000)
committeraclement <aclement>
Mon, 22 Oct 2007 08:55:47 +0000 (08:55 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java

index 103a3b89957ae8424b7967003fa6b325079ee673..609e8c8d8afc23fe5def3ea17fcc6af00017a802 100644 (file)
@@ -604,7 +604,7 @@ public class AjState {
                for (Iterator i = buildConfig.getInpath().iterator(); i.hasNext(); ) {
                        File inPathElement = (File)i.next();
                        if (inPathElement.isDirectory() && AjBuildManager.COPY_INPATH_DIR_RESOURCES) {
-                               deleteResourcesFromDirectory(inPathElement,oldResources);
+                                 deleteResourcesFromDirectory(inPathElement,oldResources);
                        }                       
                }       
                
@@ -657,8 +657,19 @@ public class AjState {
                for (int i = 0; i < files.length; i++) {
                        // ASSERT: files[i].getAbsolutePath().startsWith(inFile.getAbsolutePath()
                        // or we are in trouble...
-                       String filename = files[i].getAbsolutePath().substring(
+                       String filename=null;
+                       try {
+                               filename = files[i].getCanonicalPath().substring(
+                                           dir.getCanonicalPath().length()+1);
+                       } catch (IOException e) {
+                           // we are in trouble if this happens...
+                               IMessage msg = new Message("call to getCanonicalPath() failed for file " + files[i]+" with: "+e.getMessage(),
+                                                                                  new SourceLocation(files[i],0),false);
+                               buildManager.handler.handleMessage(msg);
+                               filename = files[i].getAbsolutePath().substring(
                                            dir.getAbsolutePath().length()+1);
+                       }
+
                        maybeDeleteResource(filename, oldResources);
                }                               
        }