| /* |
| * Created on 16.12.2005 |
| */ |
| package org.eclipse.epp.installer.internal.core; |
| |
| /** |
| * Class OS are used then needed operation system dependent function. |
| * |
| * This class USED JNI to implement functions. |
| * |
| * See library/fs.c, library/os.c for implementation. |
| * |
| * @author Max Stepanov (max@xored.com) |
| * |
| * @version $Revision: 1.2 $ |
| */ |
| public class OS { |
| |
| /** |
| * Load the library |
| * |
| */ |
| static { |
| try { |
| System.loadLibrary("os"); |
| } |
| catch (UnsatisfiedLinkError e) { |
| System.err.println("ERROR You have not installed the DLL named 'os.dll'.\n\t" + e.getMessage()); |
| throw e; |
| } |
| catch (SecurityException e) { |
| System.err.println("ERROR You do not have permission to load the DLL named 'os.dll'.\n\t" + e.getMessage()); |
| throw e; |
| } |
| } |
| |
| public static final int DRIVE_UNKNOWN = 0; |
| public static final int DRIVE_NO_ROOT_DIR = 1; |
| public static final int DRIVE_REMOVABLE = 2; |
| public static final int DRIVE_FIXED = 3; |
| public static final int DRIVE_REMOTE = 4; |
| public static final int DRIVE_CDROM = 5; |
| public static final int DRIVE_RAMDISK = 6; |
| |
| /** |
| * Delete selected file on reboot. Operation supported on Windows. Operation |
| * isn't supported on Linux. |
| * |
| * @param path |
| * String absolute path to file. |
| * @return boolean return <code>true</code> if operation are successful. |
| */ |
| public static final native boolean DeleteFileOnReboot(String path); |
| |
| /** |
| * Retrieves the path of a special folder, identified by its ID. Operation supported on Windows. |
| * Operation isn't supported on Linux. |
| * |
| * @param specialFolderId |
| * int that identifies the folder of interest. |
| * @return String return path of a special folder if operation are successful. |
| * <code>null</code> othervise. |
| */ |
| public static final native String GetSpecialFolderPath(int specialFolderId); |
| |
| |
| /** |
| * Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, |
| * or network drive. |
| * @param driveRootPath |
| * String that identifies root drive path |
| * @return int return type of a specified drive |
| */ |
| public static final native int GetDriveType( String driveRootPath ); |
| |
| /** |
| * Reboot system, on system supported this call. Only Windows are supported. |
| * On other systems, reboot aren't needed in most cases. |
| * |
| * @return boolean <code>true</code> if reboot are started. |
| * <code>false</code> othervise. |
| */ |
| public static final native boolean SystemReboot(); |
| |
| public static final native boolean SetCreationTime(String path,long time); |
| |
| public static final native boolean CanWrite(String path); |
| public static final native boolean CanRead(String path); |
| |
| public static final native boolean IsUserAdmin(); |
| } |