Ignore:
Timestamp:
2004-02-12T14:54:48+13:00 (20 years ago)
Author:
kjdon
Message:

under linux now checks for mozilla and netscape, and only if one of these is not found does it prompt the user for a browser

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/file/FileAssociationManager.java

    r6748 r6786  
    3434import org.greenstone.gatherer.gui.PreviewCommandDialog;
    3535import org.greenstone.gatherer.msm.MSMUtils;
     36import org.greenstone.gatherer.util.ExternalProgram;
    3637import org.greenstone.gatherer.util.StaticStrings;
    3738import org.greenstone.gatherer.util.Utility;
     
    118119    } else {
    119120        // we try to look for a browser
     121        String [] browsers = new String [] {"mozilla", "netscape"};
     122        for (int i=0; i<browsers.length; i++) {
     123        if (isAvailable(browsers[i])) {
     124            command = browsers[i]+ " %1";
     125            break;
     126        }
     127        }
    120128    }
    121129   
     
    303311    return entries.getLength();
    304312    }
     313
     314
     315    protected boolean isAvailable(String program) {
     316    try {
     317        ExternalProgram e = new ExternalProgram("which", program);
     318        e.exitProgram();
     319        String out = e.getLineOfProgramOutput();
     320        if (out == null) {
     321        return false;
     322        }
     323        return true;
     324    } catch (Exception exc) {
     325        return false;
     326    }
     327    }
    305328}
Note: See TracChangeset for help on using the changeset viewer.