]>
Commit | Line | Data |
---|---|---|
5f42a4ba | 1 | /** @file\r |
2 | This file is to define PlatformIdentification class.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | **/\r | |
13 | \r | |
a29c47e0 | 14 | package org.tianocore.build.id;\r |
15 | import java.io.File;\r | |
16 | \r | |
17 | import org.tianocore.build.global.GlobalData;\r | |
18 | \r | |
01413f0c | 19 | /**\r |
20 | This class is used to identify a platform. \r | |
21 | \r | |
22 | @since GenBuild 1.0\r | |
23 | **/\r | |
a29c47e0 | 24 | public class PlatformIdentification extends Identification{\r |
25 | \r | |
01413f0c | 26 | ///\r |
27 | /// FPD file\r | |
28 | ///\r | |
a29c47e0 | 29 | private File fpdFile;\r |
30 | \r | |
01413f0c | 31 | /**\r |
32 | @param guid Guid\r | |
33 | @param version Version\r | |
34 | **/\r | |
a29c47e0 | 35 | public PlatformIdentification(String guid, String version){\r |
36 | super(guid, version);\r | |
37 | }\r | |
38 | \r | |
01413f0c | 39 | /**\r |
40 | @param name Name\r | |
41 | @param guid Guid\r | |
42 | @param version Version\r | |
43 | **/\r | |
a29c47e0 | 44 | public PlatformIdentification(String name, String guid, String version){\r |
45 | super(name, guid, version);\r | |
46 | }\r | |
47 | \r | |
01413f0c | 48 | /**\r |
49 | @param name Name\r | |
50 | @param guid Guid\r | |
51 | @param version Version\r | |
52 | @param fpdFilename Fpd File Name\r | |
53 | **/\r | |
a29c47e0 | 54 | public PlatformIdentification(String name, String guid, String version, String fpdFilename){\r |
55 | super(name, guid, version);\r | |
56 | this.fpdFile = new File(fpdFilename);\r | |
57 | }\r | |
58 | \r | |
01413f0c | 59 | /**\r |
60 | @param name Name\r | |
61 | @param guid Guid\r | |
62 | @param version Version\r | |
63 | @param fpdFile Fpd File\r | |
64 | **/\r | |
a29c47e0 | 65 | public PlatformIdentification(String name, String guid, String version, File fpdFile){\r |
66 | super(name, guid, version);\r | |
67 | this.fpdFile = fpdFile;\r | |
68 | }\r | |
69 | \r | |
70 | public String toString(){\r | |
71 | return "Platform " + name + "["+guid+"]";\r | |
72 | }\r | |
73 | \r | |
01413f0c | 74 | /**\r |
75 | Set FPD file. \r | |
76 | @param fpdFile FPD File\r | |
77 | **/\r | |
a29c47e0 | 78 | public void setFpdFile(File fpdFile) {\r |
79 | this.fpdFile = fpdFile;\r | |
80 | }\r | |
81 | \r | |
01413f0c | 82 | /**\r |
83 | Get FPD file. \r | |
84 | @return Fpd File\r | |
85 | **/\r | |
a29c47e0 | 86 | public File getFpdFile() {\r |
87 | return fpdFile;\r | |
88 | }\r | |
89 | \r | |
01413f0c | 90 | /**\r |
91 | Get FPD relative file to workspace. \r | |
92 | @return Fpd Relative file. \r | |
93 | **/\r | |
de4bb9f6 | 94 | public String getRelativeFpdFile (){\r |
53d853a6 | 95 | String relativeDir = fpdFile.getPath().substring(GlobalData.getWorkspacePath().length());\r |
96 | if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r | |
97 | relativeDir = relativeDir.substring(1);\r | |
98 | }\r | |
99 | return relativeDir;\r | |
de4bb9f6 | 100 | }\r |
101 | \r | |
01413f0c | 102 | /**\r |
103 | Get Platform relative directory to workspace. \r | |
104 | @return Platform relative directory\r | |
105 | **/\r | |
a29c47e0 | 106 | public String getPlatformRelativeDir(){\r |
53d853a6 | 107 | String relativeDir = fpdFile.getParent().substring(GlobalData.getWorkspacePath().length());\r |
108 | if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r | |
109 | relativeDir = relativeDir.substring(1);\r | |
110 | }\r | |
111 | return relativeDir;\r | |
a29c47e0 | 112 | }\r |
113 | } |