Mercurial > hg > graal-jvmci-8
comparison src/share/tools/ProjectCreator/Util.java @ 2044:06f017f7daa7
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Fri, 07 Jan 2011 18:18:08 +0100 |
parents | src/share/tools/MakeDeps/Util.java@2d26b0046e0d src/share/tools/MakeDeps/Util.java@f95d63e2154a |
children | 5d801e6b9a80 |
comparison
equal
deleted
inserted
replaced
1942:00bc9eaf0e24 | 2044:06f017f7daa7 |
---|---|
1 /* | |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 | |
25 import java.util.*; | |
26 import java.util.Map.Entry; | |
27 import java.io.File; | |
28 | |
29 public class Util { | |
30 static String join(String padder, Vector v) { | |
31 return join(padder, v, false); | |
32 } | |
33 | |
34 static String join(String padder, Vector v, boolean quoted) { | |
35 StringBuffer sb = new StringBuffer(); | |
36 | |
37 for (Iterator iter = v.iterator(); iter.hasNext(); ) { | |
38 if (quoted) { | |
39 sb.append('"'); | |
40 } | |
41 sb.append((String)iter.next()); | |
42 if (quoted) { | |
43 sb.append('"'); | |
44 } | |
45 if (iter.hasNext()) sb.append(padder); | |
46 } | |
47 | |
48 return sb.toString(); | |
49 } | |
50 | |
51 static String join(String padder, String v[]) { | |
52 StringBuffer sb = new StringBuffer(); | |
53 | |
54 for (int i=0; i<v.length; i++) { | |
55 sb.append(v[i]); | |
56 if (i < (v.length - 1)) sb.append(padder); | |
57 } | |
58 | |
59 return sb.toString(); | |
60 } | |
61 | |
62 | |
63 | |
64 static String prefixed_join(String padder, Vector v, boolean quoted) { | |
65 StringBuffer sb = new StringBuffer(); | |
66 | |
67 for (Iterator iter = v.iterator(); iter.hasNext(); ) { | |
68 sb.append(padder); | |
69 | |
70 if (quoted) { | |
71 sb.append('"'); | |
72 } | |
73 sb.append((String)iter.next()); | |
74 if (quoted) { | |
75 sb.append('"'); | |
76 } | |
77 } | |
78 | |
79 return sb.toString(); | |
80 } | |
81 | |
82 | |
83 static String normalize(String file) { | |
84 return file.replace('\\', '/'); | |
85 } | |
86 | |
87 static String sep = File.separator; | |
88 | |
89 private static String _os; | |
90 | |
91 static String os() { | |
92 if( _os==null) { | |
93 | |
94 for(Map.Entry<String, String> entry: System.getenv().entrySet()) | |
95 if("PLATFORM_ARCH_MODEL".equals(entry.getKey().toUpperCase())) { | |
96 String archModel = entry.getValue(); | |
97 if("x86_32".equals(archModel)) | |
98 _os = "Win32"; | |
99 else if("x86_64".equals(archModel)) | |
100 _os = "x64"; | |
101 else | |
102 throw new RuntimeException("Unsupported PLATFORM_ARCH_MODEL " + archModel); | |
103 return _os; | |
104 } | |
105 throw new RuntimeException("PLATFORM_ARCH_MODEL not specified"); | |
106 } | |
107 return _os; | |
108 } | |
109 } |