]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/Workspace.java
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@671 6f19259b...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / workspace / Workspace.java
1 /** @file
2
3 The file is used to init workspace
4
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 package org.tianocore.frameworkwizard.workspace;
17
18 import java.io.File;
19
20 import org.tianocore.frameworkwizard.common.DataType;
21
22 public class Workspace {
23 //
24 // Define class members
25 //
26 private static String currentWorkspace = null;
27
28 private static String strWorkspaceDatabaseFile = DataType.FILE_SEPARATOR + "Tools" + DataType.FILE_SEPARATOR
29 + "Conf" + DataType.FILE_SEPARATOR + "FrameworkDatabase.db";
30
31 /**
32
33 @param args
34
35 **/
36 public static void main(String[] args) {
37 // TODO Auto-generated method stub
38
39 }
40
41 /**
42 Get Current Workspace
43
44 @return currentWorkspace
45
46 */
47 public static String getCurrentWorkspace() {
48 return currentWorkspace;
49 }
50
51 /**
52 Set Current Workspace
53
54 @param currentWorkspace
55 The input data of currentWorkspace
56
57 */
58 public static void setCurrentWorkspace(String currentWorkspace) {
59 Workspace.currentWorkspace = currentWorkspace;
60 }
61
62 /**
63 Check if current workspace exists of not
64
65 @retval true - The current WORKSPACE exists
66 @retval false - The current WORKSPACE doesn't exist
67
68 */
69 public static boolean checkCurrentWorkspace() {
70 return checkWorkspace(getCurrentWorkspace());
71 }
72
73 /**
74 Check if current workspace exists or not via input workspace path
75
76 @param strWorkspace
77 The input data of WORKSPACE path
78 @retval true - The current WORKSPACE exists
79 @retval false - The current WORKSPACE doesn't exist
80
81 */
82 public static boolean checkWorkspace(String strWorkspace) {
83 if (strWorkspace == null || strWorkspace == "") {
84 return false;
85 }
86 //
87 // Check workspace directory
88 //
89 File f = new File(strWorkspace);
90 if (!f.isDirectory()) {
91 return false;
92 }
93 if (!f.exists()) {
94 return false;
95 }
96
97 //
98 // Check FrameworkDatabase.db
99 //
100 f = new File(strWorkspace + Workspace.getStrWorkspaceDatabaseFile());
101 if (!f.exists()) {
102 return false;
103 }
104
105 return true;
106 }
107
108 public static String getStrWorkspaceDatabaseFile() {
109 return strWorkspaceDatabaseFile;
110 }
111
112 public static void setStrWorkspaceDatabaseFile(String strWorkspaceDatabaseFile) {
113 //Workspace.strWorkspaceDatabaseFile = strWorkspaceDatabaseFile;
114 }
115 }