Changeset 392


Ignore:
Timestamp:
Jul 16, 2012, 2:54:45 PM (13 years ago)
Author:
dmik
Message:

iicedtea-web: More useful defaults for JAVA.EXE and plugin jars.

JAVA.EXE is searched in PATH, plugin jars -- in a dir containing the plugin DLL,
in a subdirectory equal to the plugin DLL base name.

Location:
trunk/icedtea-web
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/icedtea-web/Config.kmk

    r376 r392  
    2727
    2828# @todo later
    29 ICEDTEA_WEB_JRE_DIR     := /@unixroot/usr/lib/jre
    30 ICEDTEA_WEB_DATA_DIR    := /@unixroot/usr/share/$(PACKAGE_NAME)
     29#ICEDTEA_WEB_JRE_DIR     := /@unixroot/usr/lib/jre
     30#ICEDTEA_WEB_DATA_DIR    := /@unixroot/usr/share/$(PACKAGE_NAME)
    3131
    3232ICEDTEA_WEB_JRE     = icedtea_web_jre_dir()
  • trunk/icedtea-web/plugin/icedteanp/Makefile.kmk

    r381 r392  
    2424                      -DPLUGIN_VERSION="\"$(PLUGIN_VERSION)\"" \
    2525                      -DPACKAGE_URL="\"$(PACKAGE_URL)\"" \
    26                       -DICEDTEA_WEB_JRE_DIR="\"$(ICEDTEA_WEB_JRE_DIR)\"" \
     26                      $(if $(ICEDTEA_WEB_JRE_DIR),-DICEDTEA_WEB_JRE_DIR="\"$(ICEDTEA_WEB_JRE_DIR)\"") \
    2727                      -DICEDTEA_WEB_JRE="$(ICEDTEA_WEB_JRE)" \
    28                       -DICEDTEA_WEB_DATA_DIR="\"$(ICEDTEA_WEB_DATA_DIR)\"" \
     28                      $(if $(ICEDTEA_WEB_DATA_DIR),-DICEDTEA_WEB_DATA_DIR="\"$(ICEDTEA_WEB_DATA_DIR)\"") \
    2929                      -DPLUGIN_BOOTCLASSPATH="$(PLUGIN_BOOTCLASSPATH)"
    3030npicedt_LIBS        = $(PATH_GLIB_LIBS) pthread
  • trunk/icedtea-web/plugin/icedteanp/os2/OS_OS2.cc

    r385 r392  
    3939#define INCL_DOS
    4040#define INCL_PM
     41#define INCL_ERRORS
    4142#include <os2.h>
    4243
    4344#include <stdlib.h>
     45#include <string.h>
    4446
    4547#include "OS_OS2.h"
     
    5052    const char *home = getenv("ICEDTEA_WEB_DATA");
    5153    if (!home)
     54    {
     55#if !defined(ICEDTEA_WEB_DATA_DIR)
     56        // deduce the path from this DLL's name
     57        static char buf[CCHMAXPATH] = {0};
     58        if (buf[0] == 0)
     59        {
     60            BOOL ok = FALSE;
     61            HMODULE hmod;
     62            ULONG objNum, offset;
     63            APIRET rc;
     64            rc = DosQueryModFromEIP(&hmod, &objNum, sizeof(buf), buf, &offset,
     65                                    (ULONG)&icedtea_web_data_dir);
     66            if (rc == NO_ERROR)
     67            {
     68                rc = DosQueryModuleName(hmod, sizeof(buf), buf);
     69                if (rc == NO_ERROR)
     70                {
     71                    // truncate the extension to get the data dir
     72                    char *end = strrchr(buf, '.');
     73                    if (end)
     74                    {
     75                        *end = '\0';
     76                        ok = TRUE;
     77                    }
     78                }
     79            }
     80            if (!ok)
     81                strcpy(buf, ".");
     82        }
     83        home = buf;
     84#else
    5285        home = ICEDTEA_WEB_DATA_DIR;
     86#endif
     87    }
    5388    return home;
    5489}
     
    5893    const char *jre = getenv("ICEDTEA_WEB_JRE");
    5994    if (!jre)
     95    {
     96#if !defined(ICEDTEA_WEB_JRE_DIR)
     97        // deduce the path from JAVA.EXE found in PATH
     98        static char buf[CCHMAXPATH] = {0};
     99        if (buf[0] == 0)
     100        {
     101            BOOL ok = FALSE;
     102            APIRET rc;
     103            rc = DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT |
     104                               SEARCH_CUR_DIRECTORY,
     105                               "PATH", "JAVA.EXE", buf, sizeof(buf));
     106            if (rc == NO_ERROR)
     107            {
     108                char *end = strrchr(buf, '\\');
     109                if (end)
     110                {
     111                    *end = '\0';
     112                    ok = TRUE;
     113                    // truncate \bin if present
     114                    end = strrchr(buf, '\\');
     115                    if (end && stricmp(end + 1, "bin") == 0)
     116                        *end = '\0';
     117                }
     118            }
     119            if (!ok)
     120                strcpy(buf, ".");
     121        }
     122        jre = buf;
     123#else
    60124        jre = ICEDTEA_WEB_JRE_DIR;
     125#endif
     126    }
    61127    return jre;
    62128}
Note: See TracChangeset for help on using the changeset viewer.