View Javadoc

1   // Win32FileSystem.java, created Fri Jan 11 17:09:56 2002 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.ClassLib.sun13_win32.java.io;
5   
6   import joeq.Memory.HeapAddress;
7   import joeq.Runtime.SystemInterface;
8   
9   /***
10   * Win32FileSystem
11   *
12   * @author  John Whaley <jwhaley@alum.mit.edu>
13   * @version $Id: Win32FileSystem.java 1456 2004-03-09 22:01:46Z jwhaley $
14   */
15  public abstract class Win32FileSystem {
16  
17      // gets the current directory on the named drive.
18      private static String getDriveDirectory(int i) {
19          byte[] b = new byte[256];
20          int result = SystemInterface.fs_getdcwd(i, b);
21          if (result == 0) throw new InternalError();
22          String res = SystemInterface.fromCString(HeapAddress.addressOf(b));
23          // skip "C:"
24          if (res.charAt(1) == ':') return res.substring(2);
25          else return res;
26      }
27  
28  }