use reflection to get proper user-domain library path on osx

This commit is contained in:
benfry
2005-02-04 02:35:16 +00:00
parent 76a13c25fe
commit 05816e9ac3
2 changed files with 21 additions and 10 deletions

View File

@@ -25,6 +25,7 @@
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.reflect.*;
import java.net.*;
import java.util.*;
import java.util.zip.*;
@@ -184,16 +185,29 @@ public class PdeBase {
// not clear if i can write to this folder tho..
try {
/*
if (false) {
// this is because the mrjtoolkit stubs don't have the
// thows exception around them
new FileInputStream("ignored");
}
*/
// this method has to be dynamically loaded, because
MRJOSType domainLibrary = new MRJOSType("dlib");
File libraryFolder = MRJFileUtils.findFolder(domainLibrary);
//MRJFileUtils.findFolder(kUserDomain, domainLibrary);
Method findFolderMethod =
MRJFileUtils.class.getMethod("findFolder",
new Class[] { Short.TYPE,
MRJOSType.class });
File libraryFolder = (File)
findFolderMethod.invoke(null, new Object[] { new Short(kUserDomain),
domainLibrary });
dataFolder = new File(libraryFolder, "Processing");
} catch (FileNotFoundException e) {
} catch (Exception e) {
// this could be FileNotFound or NoSuchMethod
//} catch (FileNotFoundException e) {
//e.printStackTrace();
//System.exit(1);
showError("Problem getting data folder",