Remove additional / or \ in relative path.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / id / PlatformIdentification.java
CommitLineData
5f42a4ba 1/** @file\r
2This file is to define PlatformIdentification class.\r
3\r
4Copyright (c) 2006, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12**/\r
13\r
a29c47e0 14package org.tianocore.build.id;\r
15import java.io.File;\r
16\r
17import org.tianocore.build.global.GlobalData;\r
18\r
19public class PlatformIdentification extends Identification{\r
20 \r
21 private File fpdFile;\r
22 \r
23 public PlatformIdentification(String guid, String version){\r
24 super(guid, version);\r
25 }\r
26 \r
27 public PlatformIdentification(String name, String guid, String version){\r
28 super(name, guid, version);\r
29 }\r
30 \r
31 public PlatformIdentification(String name, String guid, String version, String fpdFilename){\r
32 super(name, guid, version);\r
33 this.fpdFile = new File(fpdFilename);\r
34 }\r
35 \r
36 public PlatformIdentification(String name, String guid, String version, File fpdFile){\r
37 super(name, guid, version);\r
38 this.fpdFile = fpdFile;\r
39 }\r
40 \r
41 public String toString(){\r
42 return "Platform " + name + "["+guid+"]";\r
43 }\r
44\r
45 public void setFpdFile(File fpdFile) {\r
46 this.fpdFile = fpdFile;\r
47 }\r
48\r
49 public File getFpdFile() {\r
50 return fpdFile;\r
51 }\r
52 \r
de4bb9f6 53 public String getRelativeFpdFile (){\r
53d853a6 54 String relativeDir = fpdFile.getPath().substring(GlobalData.getWorkspacePath().length());\r
55 if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r
56 relativeDir = relativeDir.substring(1);\r
57 }\r
58 return relativeDir;\r
de4bb9f6 59 }\r
60 \r
a29c47e0 61 public String getPlatformRelativeDir(){\r
53d853a6 62 String relativeDir = fpdFile.getParent().substring(GlobalData.getWorkspacePath().length());\r
63 if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r
64 relativeDir = relativeDir.substring(1);\r
65 }\r
66 return relativeDir;\r
a29c47e0 67 }\r
68}