Mercurial > projects > dwt-mac
comparison dwt/internal/Library.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | 5b53d338c709 |
children | cfa563df4fdd |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
36 static const int MAJOR_VERSION = 3; | 36 static const int MAJOR_VERSION = 3; |
37 | 37 |
38 /** | 38 /** |
39 * DWT Minor version number (must be in the range 0..999) | 39 * DWT Minor version number (must be in the range 0..999) |
40 */ | 40 */ |
41 static const int MINOR_VERSION = 440; | 41 static int MINOR_VERSION = 514; |
42 | 42 |
43 /** | 43 /** |
44 * DWT revision number (must be >= 0) | 44 * DWT revision number (must be >= 0) |
45 */ | 45 */ |
46 static const int REVISION = 0; | 46 static const int REVISION = 0; |
130 /+ PORTING_LEFT | 130 /+ PORTING_LEFT |
131 static bool extract (String fileName, String mappedName) { | 131 static bool extract (String fileName, String mappedName) { |
132 FileOutputStream os = null; | 132 FileOutputStream os = null; |
133 InputStream is = null; | 133 InputStream is = null; |
134 File file = new File(fileName); | 134 File file = new File(fileName); |
135 bool extracted = false; | |
135 try { | 136 try { |
136 if (!file.exists ()) { | 137 if (!file.exists ()) { |
137 is = Library.class.getResourceAsStream ("/" + mappedName); //$NON-NLS-1$ | 138 is = Library.class.getResourceAsStream ("/" + mappedName); //$NON-NLS-1$ |
138 if (is !is null) { | 139 if (is !is null) { |
140 extracted = true; | |
139 int read; | 141 int read; |
140 byte [] buffer = new byte [4096]; | 142 byte [] buffer = new byte [4096]; |
141 os = new FileOutputStream (fileName); | 143 os = new FileOutputStream (fileName); |
142 while ((read = is.read (buffer)) !is -1) { | 144 while ((read = is.read (buffer)) !is -1) { |
143 os.write(buffer, 0, read); | 145 os.write(buffer, 0, read); |
150 } catch (Throwable e) {} | 152 } catch (Throwable e) {} |
151 } | 153 } |
152 if (load (fileName)) return true; | 154 if (load (fileName)) return true; |
153 } | 155 } |
154 } | 156 } |
157 if (load (fileName)) return true; | |
155 } catch (Throwable e) { | 158 } catch (Throwable e) { |
156 try { | 159 try { |
157 if (os !is null) os.close (); | 160 if (os !is null) os.close (); |
158 } catch (IOException e1) {} | 161 } catch (IOException e1) {} |
159 try { | 162 try { |
160 if (is !is null) is.close (); | 163 if (is !is null) is.close (); |
161 } catch (IOException e1) {} | 164 } catch (IOException e1) {} |
162 } | 165 if (extracted && file.exists ()) file.delete (); |
163 if (file.exists ()) file.delete (); | 166 } |
164 return false; | 167 return false; |
165 } | 168 } |
166 | 169 |
167 static bool load (String libName) { | 170 static bool load (String libName) { |
168 try { | 171 try { |