Ignore:
Timestamp:
12/05/09 12:26:07 (2 years ago)
Author:
octorian
Message:

Platform info and factory updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LogicMail/src/org/logicprobe/LogicMail/PlatformInfoBB42.java

    r553 r560  
    3131package org.logicprobe.LogicMail; 
    3232 
     33import java.util.Enumeration; 
     34import java.util.Vector; 
     35 
     36import javax.microedition.io.Connector; 
     37import javax.microedition.io.file.FileConnection; 
     38import javax.microedition.io.file.FileSystemRegistry; 
     39 
    3340import net.rim.device.api.system.CodeModuleManager; 
    3441 
    3542public class PlatformInfoBB42 extends PlatformInfo { 
    3643    protected String platformVersion; 
     44    protected String[] filesystemRoots; 
    3745 
     46    private static String FILE_URL_PREFIX = "file:///"; 
     47     
    3848    public PlatformInfoBB42() { 
    3949    } 
     
    5868        return false; 
    5969    } 
     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    } 
    6096} 
Note: See TracChangeset for help on using the changeset viewer.