Mercurial > hg > graal-jvmci-8
comparison src/share/tools/ProjectCreator/Util.java @ 2273:2ab52cda08e5
Merge with OpenJDK.
author | Thomas Wuerthinger <thomas.wuerthinger@gmail.com> |
---|---|
date | Thu, 03 Mar 2011 19:25:53 +0100 |
parents | 30fd69882184 15d6977f04b0 |
children | 0654ee04b214 |
comparison
equal
deleted
inserted
replaced
2219:0a14ff0a8cc4 | 2273:2ab52cda08e5 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
45 } | 45 } |
46 | 46 |
47 return sb.toString(); | 47 return sb.toString(); |
48 } | 48 } |
49 | 49 |
50 static String join(String padder, String v[]) { | 50 static String join(String padder, String v[]) { |
51 StringBuffer sb = new StringBuffer(); | 51 StringBuffer sb = new StringBuffer(); |
52 | 52 |
53 for (int i=0; i<v.length; i++) { | 53 for (int i=0; i<v.length; i++) { |
54 sb.append(v[i]); | 54 sb.append(v[i]); |
55 if (i < (v.length - 1)) sb.append(padder); | 55 if (i < (v.length - 1)) sb.append(padder); |
78 return sb.toString(); | 78 return sb.toString(); |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 static String normalize(String file) { | 82 static String normalize(String file) { |
83 return file.replace('\\', '/'); | 83 file = file.replace('\\', '/'); |
84 if (file.length() > 2) { | |
85 if (file.charAt(1) == ':' && file.charAt(2) == '/') { | |
86 // convert drive letter to uppercase | |
87 String drive = file.substring(0, 1).toUpperCase(); | |
88 return drive + file.substring(1); | |
89 } | |
90 } | |
91 return file; | |
84 } | 92 } |
85 | 93 |
86 static String sep = File.separator; | 94 static String sep = File.separator; |
87 | |
88 private static String _os; | |
89 | |
90 static String os() { | |
91 if( _os==null) { | |
92 | |
93 for(Map.Entry<String, String> entry: System.getenv().entrySet()) | |
94 if("PLATFORM_ARCH_MODEL".equals(entry.getKey().toUpperCase())) { | |
95 String archModel = entry.getValue(); | |
96 if("x86_32".equals(archModel)) | |
97 _os = "Win32"; | |
98 else if("x86_64".equals(archModel)) | |
99 _os = "x64"; | |
100 else | |
101 throw new RuntimeException("Unsupported PLATFORM_ARCH_MODEL " + archModel); | |
102 System.out.println("Found OS configuration: " + _os); | |
103 return _os; | |
104 } | |
105 throw new RuntimeException("PLATFORM_ARCH_MODEL not specified"); | |
106 } | |
107 return _os; | |
108 } | |
109 | |
110 } | 95 } |