- Timestamp:
- 12/05/09 12:26:07 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LogicMail/src/org/logicprobe/LogicMail/PlatformInfoBB42.java
r553 r560 31 31 package org.logicprobe.LogicMail; 32 32 33 import java.util.Enumeration; 34 import java.util.Vector; 35 36 import javax.microedition.io.Connector; 37 import javax.microedition.io.file.FileConnection; 38 import javax.microedition.io.file.FileSystemRegistry; 39 33 40 import net.rim.device.api.system.CodeModuleManager; 34 41 35 42 public class PlatformInfoBB42 extends PlatformInfo { 36 43 protected String platformVersion; 44 protected String[] filesystemRoots; 37 45 46 private static String FILE_URL_PREFIX = "file:///"; 47 38 48 public PlatformInfoBB42() { 39 49 } … … 58 68 return false; 59 69 } 70 71 public String[] getFilesystemRoots() { 72 if(filesystemRoots == null) { 73 Vector validRoots = new Vector(); 74 StringBuffer buf = new StringBuffer(FILE_URL_PREFIX); 75 int prefixLength = FILE_URL_PREFIX.length(); 76 Enumeration e = FileSystemRegistry.listRoots(); 77 while(e.hasMoreElements()) { 78 buf.append((String)e.nextElement()); 79 String url = buf.toString(); 80 buf.delete(prefixLength, buf.length()); 81 82 try { 83 FileConnection conn = (FileConnection)Connector.open(url); 84 if(conn.exists() && conn.isDirectory() && conn.canRead() && conn.canWrite()) { 85 validRoots.addElement(url); 86 } 87 conn.close(); 88 } catch (Exception ex) { 89 } 90 } 91 filesystemRoots = new String[validRoots.size()]; 92 validRoots.copyInto(filesystemRoots); 93 } 94 return filesystemRoots; 95 } 60 96 }
Note: See TracChangeset
for help on using the changeset viewer.
