summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneilm <neilm@openoffice.org>2002-11-22 15:07:12 +0000
committerneilm <neilm@openoffice.org>2002-11-22 15:07:12 +0000
commit99e44cb1e6a24d1229149f8052ee4101353fd5c6 (patch)
tree89b8076884a9fdb82aaf284bf0906b4c55ff7130
parentbc5c0d012281f3d95706e8f669b24ed2a163c93a (diff)
Windows Office detection problems corrected
-rw-r--r--scripting/workben/installer/InstUtil.java30
-rw-r--r--scripting/workben/installer/Welcome.java33
2 files changed, 40 insertions, 23 deletions
diff --git a/scripting/workben/installer/InstUtil.java b/scripting/workben/installer/InstUtil.java
index 93af9dfefeab..935f86d48aaf 100644
--- a/scripting/workben/installer/InstUtil.java
+++ b/scripting/workben/installer/InstUtil.java
@@ -74,28 +74,15 @@ public class InstUtil {
StringBuffer thePath = new StringBuffer(str.toString());
String os = System.getProperty("os.name");
-
+
if (os.indexOf("Windows") != -1) {
- /*String appData = winGetAppData;
- if (os.equals("Windows 2000")) {
+ boolean bSVersionInHomeDir = new File(thePath.toString() + "sversion.ini").exists();
+
+ if (!bSVersionInHomeDir) {
thePath.append("Application Data");
thePath.append(sep);
- theFile = new File(thePath.toString());
- } else if (os.indexOf("Windows") != -1) {
- thePath.append(sep);
- thePath.append("sversion.ini");
- theFile = new File(thePath.toString());
- if (!theFile.exists())
- {
- thePath.delete(0, thePath.length());
- thePath.append(str);
- thePath.append("Application Data");
- thePath.append(sep);
- thePath.append("sversion.ini");
- theFile = new File(thePath.toString());
- }
- }*/
- theFile = findVersionFile(new File(str.toString()));
+ }
+ theFile = findVersionFile(new File(thePath.toString()));
} else if (os.indexOf("SunOS") != -1) {
thePath.append(".sversionrc");
theFile = new File(thePath.toString());
@@ -112,6 +99,7 @@ public class InstUtil {
{
throw new IOException("Could not locate the OpenOffice settings file.\nAre you sure StarOffice is installed on your system?");
}
+ System.out.println("buildSversionLocation: os " + os + " thePath " + thePath + " theFile " + theFile);
return theFile;
}
@@ -399,7 +387,7 @@ public class InstUtil {
URL url = new URL("file://" + parts[1].trim());
String opSys =System.getProperty("os.name");
if (opSys.indexOf("Windows")!=-1){
- //System.err.println( "InstUtil URLDecoder path: " + URLDecoder.decode( url.getPath() ) );
+ System.out.println( "InstUtil URLDecoder path: " + URLDecoder.decode( url.getPath() ) );
String windowsPath = URLDecoder.decode( url.getPath() );
boolean firstSlash = true;
while( windowsPath.indexOf("/") != -1 ) {
@@ -416,7 +404,7 @@ public class InstUtil {
}
int lastSlash = windowsPath.lastIndexOf("\\");
windowsPath = windowsPath.substring( 0, lastSlash );
- //System.out.println( "InstUtil URLDecoder windowsPath " + windowsPath );
+ System.out.println( "InstUtil URLDecoder windowsPath " + windowsPath );
results.put( parts[0].trim(), windowsPath );
}
else {
diff --git a/scripting/workben/installer/Welcome.java b/scripting/workben/installer/Welcome.java
index 7ed877332623..97c571503eb9 100644
--- a/scripting/workben/installer/Welcome.java
+++ b/scripting/workben/installer/Welcome.java
@@ -124,11 +124,40 @@ public class Welcome extends javax.swing.JPanel implements ActionListener {
String key = versions[i];
String progPath = ( String )props.getProperty( key );
if ( progPath != null ){
- progPath = progPath + "program";
- if( userDir.equals( progPath ) ){
+ String os = System.getProperty("os.name");
+
+ if (os.indexOf("Windows") != -1) {
+ progPath = progPath + System.getProperty("file.separator") + "program";
+ }
+ else
+ {
+ progPath = progPath + "program";
+ }
+
+ File tmpFile = new File(progPath+ "oostubversion.txt");
+ try{
+ tmpFile.createNewFile();
+
+ //System.out.println(new File(userDir).toURL().toString());
+ //System.out.println("versionMatch: progPath " + progPath + " userDir " + userDir + " iMatch " + iMatch);
+ if( new File(userDir+ "oostubversion.txt").exists())
+ {
versionMatch = true;
break;
}
+ }
+ catch( IOException e)
+ {
+ // Fail silently
+ }
+ tmpFile.delete();
+
+ /*
+ URL url = new URL("file://" + parts[1].trim());
+ String opSys =System.getProperty("os.name");
+ if (opSys.indexOf("Windows")!=-1){
+ System.out.println( "InstUtil URLDecoder path: " + URLDecoder.decode( url.getPath() ) );
+ */
}
}
return versionMatch;