Ejemplo n.º 1
0
void initializeMessages(char *localeString) {
    char msgFileName[MAXPATHLEN];

    /*  construct name of localized message property file, such as:
     *  C:\Program Files\Java Web Start\resources\messages_en_US.properties
     */
    sprintf(msgFileName, "%s%c%s%s%s",
	sysGetJavawsResourcesLib(),
	FILE_SEPARATOR,
	"messages_",
        localeString,
	".properties");

    MsgFileHead = parsePropertyFile(msgFileName, NULL);

    if (MsgFileHead == NULL) {
      char *p = 0;
      if ((p = strrchr(localeString, '_')) != NULL) {
	*p=0;
      }
      sprintf(msgFileName, "%s%c%s%s%s",
	      sysGetJavawsResourcesLib(),	   
	      FILE_SEPARATOR,
	      "messages_",
	      localeString,
	      ".properties");
    }
      
    MsgFileHead = parsePropertyFile(msgFileName, NULL);

    if (MsgFileHead == NULL) {
        /* OK - no localized file for this local, try non-localized:
         *      C:\Program Files\Java Web Start\resources\messages.properties
          *
         */
        sprintf(msgFileName, "%s%c%s",
            sysGetJavawsResourcesLib(),   
            FILE_SEPARATOR, 
            "messages.properties");

        MsgFileHead = parsePropertyFile(msgFileName, NULL);
    }
    if (MsgFileHead == NULL) {
	/* now we have classic - double fault - fatal error generating error msg
         * we have to abort w/o translated message
	 */
	
	Abort("Can not find message file");
    }
}
/* CL: Code factored out of original version of LoadConfigurationFile(),
 * so this code can be used by other types of configuration loading
 * functions if desired.
 */
void LoadCfgFile(char* propFileName, PropertyFileEntry** UserPropertyFileEntry, int verbose) {
  char propFullFileName[MAXPATHLEN];
 
  /* Build string to user-specific property file name
     (e.g., "deployment.properties" or "deployment.properties.jdpa") */
  sysStrNPrintF(propFullFileName, sizeof(propFullFileName), "%s%c%s",
          sysGetDeploymentUserHome(),
          FILE_SEPARATOR,
          propFileName);

  /* Load and parse the users configuration property file, adding to system */
  *UserPropertyFileEntry = parsePropertyFile(propFullFileName, NULL); 
  if (verbose) {
    printf("LoadCfgFile: %s\n", propFullFileName);
    PrintPropertyEntry(*UserPropertyFileEntry);
  }
}