working on osx distribution

This commit is contained in:
benfry
2002-07-30 05:37:08 +00:00
parent 50a99fd5ce
commit 41dcee1e9c
4 changed files with 90 additions and 32 deletions
+32 -5
View File
@@ -68,7 +68,7 @@ public class PdeBase implements ActionListener {
static public void main(String args[]) {
//System.getProperties().list(System.out);
System.out.println(System.getProperty("java.class.path"));
//System.out.println(System.getProperty("java.class.path"));
PdeBase app = new PdeBase();
}
@@ -86,9 +86,27 @@ public class PdeBase implements ActionListener {
properties = new Properties();
try {
//properties.load(new FileInputStream("lib/pde.properties"));
properties.load(getClass().getResource("pde.properties").openStream());
String platformProps = "pde.properties_" + platforms[platform];
properties.load(getClass().getResource(platformProps).openStream());
//#URL where = getClass().getResource("PdeBase.class");
//System.err.println(where);
//System.getProperties().list(System.err);
//System.err.println("userdir = " + System.getProperty("user.dir"));
if (PdeBase.platform == PdeBase.MACOSX) {
String pkg = "Proce55ing.app/Contents/Resources/Java/";
properties.load(new FileInputStream(pkg + "pde.properties"));
properties.load(new FileInputStream(pkg + "pde.properties_macosx"));
} else if (PdeBase.platform == PdeBase.MACOS9) {
properties.load(new FileInputStream("lib/pde.properties"));
properties.load(new FileInputStream("lib/pde.properties_macos9"));
} else {
// under win95, current dir not set properly
// so using a relative url like "lib/" won't work
properties.load(getClass().getResource("pde.properties").openStream());
String platformProps = "pde.properties_" + platforms[platform];
properties.load(getClass().getResource(platformProps).openStream());
}
//properties.list(System.out);
} catch (Exception e) {
@@ -615,7 +633,16 @@ public class PdeBase implements ActionListener {
//image = applet.getImage(applet.getCodeBase(), name);
//} else {
Toolkit tk = Toolkit.getDefaultToolkit();
image = tk.getImage(who.getClass().getResource(name));
if (PdeBase.platform == PdeBase.MACOSX) {
String pkg = "Proce55ing.app/Contents/Resources/Java/";
image = tk.getImage(pkg + name);
} else if (PdeBase.platform == PdeBase.MACOS9) {
image = tk.getImage("lib/" + name);
} else {
image = tk.getImage(who.getClass().getResource(name));
}
//image = tk.getImage("lib/" + name);
//URL url = PdeApplet.class.getResource(name);
//image = tk.getImage(url);
+30 -12
View File
@@ -137,7 +137,16 @@ public class PdeEditor extends Panel {
Properties skprops = new Properties();
try {
skprops.load(getClass().getResource("sketch.properties").openStream());
if (PdeBase.platform == PdeBase.MACOSX) {
String pkg = "Proce55ing.app/Contents/Resources/Java/";
skprops.load(new FileInputStream(pkg + "sketch.properties"));
} else if (PdeBase.platform == PdeBase.MACOS9) {
skprops.load(new FileInputStream("lib/pde.properties"));
} else {
skprops.load(getClass().getResource("sketch.properties").openStream());
}
int windowX = Integer.parseInt(skprops.getProperty("window.x", "-1"));
int windowY = Integer.parseInt(skprops.getProperty("window.y", "-1"));
@@ -343,6 +352,11 @@ public class PdeEditor extends Panel {
//if (program.length() != 0) {
String buildPath = "lib" + File.separator + "build"; // TEMPORARY
if (PdeBase.platform == PdeBase.MACOSX) {
String pkg = "Proce55ing.app/Contents/Resources/Java/";
buildPath = pkg + "build";
}
File buildDir = new File(buildPath);
if (!buildDir.exists()) buildDir.mkdirs();
@@ -1229,18 +1243,22 @@ public class PdeEditor extends Panel {
// write sketch.properties
try {
URL url = getClass().getResource("buttons.gif");
//String urlstr = url.toString();
//System.out.println(url.getFile());
//urlstr = urlstr.substring(6, urlstr.lastIndexOf("/") + 1) +
//"sketch.properties";
String urlstr = url.getFile();
urlstr = urlstr.substring(0, urlstr.lastIndexOf("/") + 1) +
"sketch.properties";
FileOutputStream output = null;
//System.out.println(urlstr);
//System.exit(0);
FileOutputStream output = new FileOutputStream(urlstr);
if (PdeBase.platform == PdeBase.MACOSX) {
String pkg = "Proce55ing.app/Contents/Resources/Java/";
output = new FileOutputStream(pkg + "sketch.properties");
} else if (PdeBase.platform == PdeBase.MACOS9) {
output = new FileOutputStream("lib/pde.properties");
} else { // win95/98/ME doesn't set cwd properly
URL url = getClass().getResource("buttons.gif");
String urlstr = url.getFile();
urlstr = urlstr.substring(0, urlstr.lastIndexOf("/") + 1) +
"sketch.properties";
output = new FileOutputStream(urlstr);
}
//url = new URL(urlstr + "sketch.properties");
+28 -15
View File
@@ -1,6 +1,8 @@
#!/bin/sh
REVISION=`head -c 4 ../../../todo.txt`
#REVISION=`head -c 4 ../../../todo.txt`
# 'head' for osx doesn't support -c.. what a pisser
REVISION=0000
./make.sh
@@ -11,34 +13,44 @@ rm -rf processing
rm -f processing-*.hqx
# use 'shared' files as starting point
cp -r ../shared processing
# something like the following might be better:
# find / -name "*.mp3" -exec rm -f {}\;
# and same for cvsignore
cp -r ../shared/fonts processing/
cp -r ../shared/reference processing/
cp -r ../shared/sketchbook processing/
rm -rf processing/CVS
rm -rf processing/lib/CVS
#rm -rf processing/lib/CVS
rm -rf processing/fonts/CVS
rm -rf processing/reference/CVS
rm -rf processing/reference/images/CVS
rm -rf processing/sketchbook/CVS
rm -rf processing/sketchbook/default/CVS
rm -f processing/sketchbook/default/.cvsignore
# will need to add a zillion of these for the reference..
# add java (jre) files
#unzip -q -d processing jre.zip
# get package from the dist dir
cp -r dist/Proce55ing.app processing/
rm -rf processing/Proce55ing.app/CVS
rm -rf processing/Proce55ing.app/Contents/CVS
rm -rf processing/Proce55ing.app/Contents/MacOS/CVS
rm -rf processing/Proce55ing.app/Contents/Resources/CVS
rm -rf processing/Proce55ing.app/Contents/Resources/Java/CVS
RES=processing/Proce55ing.app/Contents/Resources/Java/
cp ../shared/dist/lib/*.jar $RES/
cp ../shared/dist/lib/pde.properties $RES/
cp ../shared/dist/lib/buttons.gif $RES/
cp comm.jar $RES/
# directories used by the app
mkdir processing/lib/build
#mkdir processing/lib/build
# grab pde.jar and export from the working dir
cp work/lib/pde.jar processing/lib/
cp -r work/lib/export processing/lib/
rm -rf processing/lib/export/CVS
cp work/lib/pde.jar $RES/
cp -r work/lib/export $RES/
rm -rf $RES/export/CVS
# get platform-specific goodies from the dist dir
cp dist/Proce55ing processing/
cp dist/lib/pde.properties_macosx processing/lib/
#cp dist/Proce55ing processing/
#cp dist/lib/pde.properties_macosx processing/lib/
# convert notes.txt to windows LFs
# the 2> is because the app is a little chatty
@@ -53,5 +65,6 @@ mv processing $P5-macosx
#zip -rq $P5.zip $P5
# nah, keep the new directory around
#rm -rf $P5
# if there is a command line tool to make a dmg from this dir.. hmm
echo Done.