Ignore:
Timestamp:
2021-09-22T17:56:15+12:00 (3 years ago)
Author:
anupama
Message:

Using the newly added util subroutine get_first_existing_dir(list_of_dirs), just committed prior to this, to search through all known default locations where openoffice and libre_office may be installed for the first directory that may exist. This is to further reduce the likelihood of having to set SOFFICE_HOME. Was found necessary on this test machine where LibreOffice instead of OpenOffice is installed and not in the default location of OpenOffice.

Location:
gs2-extensions/open-office/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/open-office/trunk/src/perllib/plugins/OpenOfficeConverter.pm

    r35415 r35453  
    8484        # and open office is on a remote windows machine
    8585        if(!defined $ENV{'SOFFICE_HOME'}) {
    86             $ENV{'SOFFICE_HOME'} = &FileUtils::filenameConcatenate($ENV{'ProgramFiles'},"OpenOffice.org 3");
     86            # check all the favourite haunts of openoffice in turn
     87            $ENV{'SOFFICE_HOME'} = &util::get_first_existing_dir(
     88                &FileUtils::filenameConcatenate($ENV{'ProgramFiles'},"OpenOffice.org 3"),
     89                &FileUtils::filenameConcatenate($ENV{'ProgramFiles(X86)'},"OpenOffice.org 3"),
     90                &FileUtils::filenameConcatenate($ENV{'ProgramFiles'},"LibreOffice"),
     91                &FileUtils::filenameConcatenate($ENV{'ProgramFiles(X86)'},"LibreOffice")               
     92            );
     93           
     94            # These 2 env vars are diff and appear as expected when printed out in a cmd prompt on a 64 bit Windows. But on same machine
     95            # in perl, at least when launched through (Java 32 bit) GLI, their values shown as the same: as "C:\Program Files (x86)"
     96            #print STDERR "@@@@ ProgFiles: $ENV{'ProgramFiles'}\n";
     97            #print STDERR "@@@@ ProgFiles x86: $ENV{'ProgramFiles(X86)'}\n";
    8798        }
    88         my $ooffice_dir_guess =
    89             &FileUtils::filenameConcatenate($ENV{'SOFFICE_HOME'},"program");
    90         if (-d  $ooffice_dir_guess) {
    91             &util::envvar_append("PATH",$ooffice_dir_guess);
     99        if(defined $ENV{'SOFFICE_HOME'}) {
     100            #print STDERR "@@@@ Found $ENV{'SOFFICE_HOME'}\n";
     101            my $ooffice_dir_guess =
     102                &FileUtils::filenameConcatenate($ENV{'SOFFICE_HOME'},"program");
     103            if (-d  $ooffice_dir_guess) {
     104                &util::envvar_append("PATH",$ooffice_dir_guess);
     105            }
    92106        }
    93 
     107       
    94108        # for windows, when working on a remote system, want to be able to start OO if
    95109        # not already running. We'll use the uno socket method to do so. Else client-gli
Note: See TracChangeset for help on using the changeset viewer.