/** * Get the path * traverse the handset all follow the path, find out the maximum free space path as the return value, * and in RMS, the next startup program directly from the RMS read path * * @return */public String GETPHONEP
Ath () {String phonepath = "";
try {recordstore rootpathrms = Recordstore.openrecordstore ("Phonepath", true);
int num = Rootpathrms.getnumrecords ();
if (num > 0) {byte[] b = Rootpathrms.getrecord (1);
Phonepath = new String (b, "Utf-8"); } else if (Phonepath.equals ("") | | |
Phonepath = = null) {string[] roots = new STRING[10];
Enumeration E = Filesystemregistry.listroots ();
int i = 0;
while (E.hasmoreelements ()) {String root = (string) e.nextelement ();
Roots[i] = root;
i++;
} long[] rootsizes = new Long[i];
for (int j = 0; J < i; J + +) {Fileconnection FC;
try {fc = (fileconnection) connector.open ("file:///" + roots[j]);
ROOTSIZES[J] = Fc.availablesize ();
} catch (IOException E1) {e1.printstacktrace ();
}} int index = 0;
Long temp = 0; for (int h = 0; h < rootsizes.length; h++) {if (Rootsizes[h] > Temp) {temp = rootsizes[h];
index = h;
} else continue;
} Phonepath = Roots[index];
Rootpathrms.addrecord (Phonepath.getbytes (), 0, Phonepath.getbytes (). length);
}} catch (Recordstorefullexception e) {e.printstacktrace ();
} catch (Recordstorenotfoundexception e) {e.printstacktrace ();
} catch (Recordstoreexception e) {e.printstacktrace ();
} catch (Unsupportedencodingexception e) {e.printstacktrace ();
} finally {try {rootpathrms.closerecordstore ();
} catch (Recordstorenotopenexception e) {e.printstacktrace ();
} catch (Recordstoreexception e) {e.printstacktrace ();
}} return Phonepath; }