How can i get my client/server to support mac and Linux users!
[code]public static String findcachedir()
{
boolean exists = (new File(System.getProperty(“user.home”) + “/.OS-Legacy-V1.2/”)).exists();
if (exists) {
return System.getProperty(“user.home”) + “/.OS-Legacy-V1.2/”;
} else {
File f = new File(System.getProperty(“user.home”) + “/.OS-Legacy-V1.2/”);
f.mkdir();
return System.getProperty(“user.home”) + “/.OS-Legacy-V1.2/”;
}
}
public static String sencondDir() {
File file = new File(“c:/.OS-Legacy-V1.2/”);
if (!file.exists())
file.mkdir();
return file.toString();
}
public static String findcachedirORIG()
{
String as[] = {
"c:/windows/", "c:/winnt/", "d:/windows/", "d:/winnt/", "e:/windows/", "e:/winnt/", "f:/windows/", "f:/winnt/", "c:/", "~/",
"/tmp/", "", "c:/rscache", "/rscache"
};
if(storeid < 32 || storeid > 34)
storeid = 32;
String s = ".file_store_" + storeid;
for(int i = 0; i < as.length; i++)
try
{
String s1 = as[i];
if(s1.length() > 0)
{
File file = new File(s1);
if(!file.exists())
continue;
}
File file1 = new File(s1 + s);
if(file1.exists() || file1.mkdir())
return s1 + s + "/";
}
catch(Exception _ex) { }
return null;
}
public static int getuid(String s)
{
try
{
File file = new File(s + "uid.dat");
if(!file.exists() || file.length() < 4L)
{
DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(s + "uid.dat"));
dataoutputstream.writeInt((int)(Math.random() * 99999999D));
dataoutputstream.close();
}
}
catch(Exception _ex) { }
try
{
DataInputStream datainputstream = new DataInputStream(new FileInputStream(s + "uid.dat"));
int i = datainputstream.readInt();
datainputstream.close();
return i + 1;
}
catch(Exception _ex)
{
return 0;
}
}[/code]