/*
 * Copyright LWJGL. All rights reserved.
 * License terms: http://lwjgl.org/license.php
 */
package org.lwjgl;

import static org.lwjgl.LWJGLUtil.*;

/**
 * System class. The static initializers in this class must run before
 * anything else executes in LWJGL.
 */
public final class Sys {

	/** The native library name */
	public static final String JNI_LIBRARY_NAME = System.getProperty("org.lwjgl.libname", System.getProperty("os.arch").contains("64") ? "lwjgl" : "lwjgl32");

	/** Current version of library. */
	public static final int
		VERSION_MAJOR    = 3,
		VERSION_MINOR    = 0,
		VERSION_REVISION = 0;

	/** The development state of the current build. */
	public static final BuildType BUILD_TYPE = BuildType.BETA;

	static {
		log("Version " + getVersion() + " | " + System.getProperty("os.name") + " | " + System.getProperty("os.arch"));
		try {
			LWJGLUtil.loadLibrarySystem(JNI_LIBRARY_NAME);
		} catch (Throwable t) {
			// Failed, attempt to extract the natives from the classpath
			SharedLibraryLoader.load();
			// and try again
			LWJGLUtil.loadLibrarySystem(JNI_LIBRARY_NAME);
		}
	}

	private Sys() {
	}

	// Dummy method to trigger the static initializers.
	static void touch() {
		// Intentionally empty
	}

	// Returns sizeof(void *)
	static native int getPointerSize();

	/** Returns the LWJGL version. */
	public static String getVersion() {
		return String.valueOf(VERSION_MAJOR) + '.' + VERSION_MINOR + '.' + VERSION_REVISION + BUILD_TYPE.postfix;
	}

	public static void main(String[] args) {
		System.out.println(getVersion());
	}

	/** The development state of the current build. */
	public enum BuildType {
		/** Work in progress, unstable. */
		ALPHA("a"),
		/** Feature complete, unstable. */
		BETA("b"),
		/** Feature complete, stable, official release. */
		STABLE("");

		final String postfix;

		BuildType(String postfix) {
			this.postfix = postfix;
		}
	}

}
@@ -108,16 +108,127 @@
 lwjgl;%0A%0A
+import java.io.InputStream;%0Aimport java.net.URL;%0Aimport java.util.jar.JarFile;%0Aimport java.util.jar.Manifest;%0A%0A
 import s
@@ -1584,16 +1584,680 @@
 .postfix
+ + ' ' + getVersionImpl();%0A%09%7D%0A%0A%09private static String getVersionImpl() %7B%0A%09%09URL url = Sys.class.getClassLoader().getResource(%22org/lwjgl/Sys.class%22);%0A%09%09if ( url != null ) %7B%0A%09%09%09String classURL = url.toString();%0A%09%09%09if ( classURL.startsWith(%22jar:%22) ) %7B%0A%09%09%09%09try %7B%0A%09%09%09%09%09InputStream stream = new URL(%0A%09%09%09%09%09%09classURL.substring(0, classURL.lastIndexOf(%22!%22) + 1) + '/' + JarFile.MANIFEST_NAME%0A%09%09%09%09%09).openStream();%0A%0A%09%09%09%09%09try %7B%0A%09%09%09%09%09%09return new Manifest(stream)%0A%09%09%09%09%09%09%09.getAttributes(%22org/lwjgl/%22)%0A%09%09%09%09%09%09%09.getValue(%22Implementation-Version%22);%0A%09%09%09%09%09%7D finally %7B%0A%09%09%09%09%09%09stream.close();%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D catch (Exception e) %7B%0A%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09return %22SNAPSHOT%22
 ;%0A%09%7D%0A%0A%09p

Include the build number in Sys.getVersion()