Remove additional / or \ in relative path.
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Jul 2006 05:22:00 +0000 (05:22 +0000)
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Jul 2006 05:22:00 +0000 (05:22 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1134 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java
Tools/Source/GenBuild/org/tianocore/build/id/PackageIdentification.java
Tools/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java

index 9371c7e..2d8ed0b 100644 (file)
@@ -14,13 +14,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 package org.tianocore.build;\r
 \r
 import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.InputStream;\r
 import java.util.Vector;\r
 \r
 import javax.xml.namespace.QName;\r
-import javax.xml.parsers.DocumentBuilder;\r
-import javax.xml.parsers.DocumentBuilderFactory;\r
 \r
 import org.apache.tools.ant.BuildException;\r
 import org.apache.tools.ant.Project;\r
@@ -32,9 +28,7 @@ import org.tianocore.build.global.SurfaceAreaQuery;
 import org.tianocore.build.id.FpdModuleIdentification;\r
 import org.w3c.dom.Document;\r
 import org.w3c.dom.Element;\r
-import org.w3c.dom.NamedNodeMap;\r
 import org.w3c.dom.Node;\r
-import org.w3c.dom.NodeList;\r
 \r
 /** \r
   <p><code>FfsProcess</code> is a class to find the corresponding FFS layout. </p>\r
index 530e4e7..815fd44 100644 (file)
@@ -68,7 +68,11 @@ public class PackageIdentification extends Identification{
     \r
     public String getPackageRelativeDir(){\r
         prepareSpdFile();\r
-        return spdFile.getParent().substring(GlobalData.getWorkspacePath().length() + 1);\r
+        String relativeDir =spdFile.getParent().substring(GlobalData.getWorkspacePath().length());\r
+        if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r
+          relativeDir = relativeDir.substring(1);\r
+        }\r
+        return relativeDir;\r
     }\r
     \r
     private void prepareSpdFile(){\r
index 39a13d9..c5c2f1e 100644 (file)
@@ -51,10 +51,18 @@ public class PlatformIdentification extends Identification{
     }\r
     \r
     public String getRelativeFpdFile (){\r
-        return fpdFile.getPath().substring(GlobalData.getWorkspacePath().length() + 1);\r
+        String relativeDir = fpdFile.getPath().substring(GlobalData.getWorkspacePath().length());\r
+        if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r
+            relativeDir = relativeDir.substring(1);\r
+        }\r
+        return relativeDir;\r
     }\r
     \r
     public String getPlatformRelativeDir(){\r
-        return fpdFile.getParent().substring(GlobalData.getWorkspacePath().length() + 1);\r
+        String relativeDir = fpdFile.getParent().substring(GlobalData.getWorkspacePath().length());\r
+        if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r
+            relativeDir = relativeDir.substring(1);\r
+        }\r
+        return relativeDir;\r
     }\r
 }
\ No newline at end of file