Commit 74a825e6 authored by Martin Avison's avatar Martin Avison Committed by ROOL
Browse files

Add Log message giving source for Boot, System & Font Merges

Utilise Install_Log command (from Installer-0_18) to log the source directory
for a Merge. If the command does not exist, it does not give error.

During testing of the above change, a bug in the !Font merge process
was found that can cause it to put merged fonts in totally the wrong place.

The function static_ReadVariables() in Main.c, if APP=FONTMERGE, uses the
value of Font$Path to set Destination (the merge target) from the third path
element from the end, which assumes it is the system !Fonts.

However, if a
    *FontInstall mydirectory.
was done before the *FontInstall in BootResources:!Fonts, then Font$Path will
be set to 4 elements, eg:
    ADFS::SSD.$.!BOOT.Resources.!Fonts.,
    mydirectory.,
    <Font$Prefix>.,
    Resources:$.Fonts.
so any new fonts wrongly go into mydirectory.

The fix now finds the first directory seen which ends in ".!Fonts.", which is
the LAST one in the path string. This is better, though not totally foolproof.

Version 2.12. Tagged as 'Config2PluginxxxxMerge-2_12'
parent 85c19557
No preview for this file type
No preview for this file type
No preview for this file type
/* (2.11) /* (2.12)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* *
*/ */
#define Module_MajorVersion_CMHG 2.11 #define Module_MajorVersion_CMHG 2.12
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 03 Aug 2024 #define Module_Date_CMHG 11 Jan 2025
#define Module_MajorVersion "2.11" #define Module_MajorVersion "2.12"
#define Module_Version 211 #define Module_Version 212
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "03 Aug 2024" #define Module_Date "11 Jan 2025"
#define Module_ApplicationDate "03-Aug-24" #define Module_ApplicationDate "11-Jan-25"
#define Module_ComponentName "Config2PluginxxxxMerge" #define Module_ComponentName "Config2PluginxxxxMerge"
#define Module_FullVersion "2.11" #define Module_FullVersion "2.12"
#define Module_HelpVersion "2.11 (03 Aug 2024)" #define Module_HelpVersion "2.12 (11 Jan 2025)"
#define Module_LibraryVersionInfo "2:11" #define Module_LibraryVersionInfo "2:12"
...@@ -335,27 +335,46 @@ static void static_ReadVariables (void) ...@@ -335,27 +335,46 @@ static void static_ReadVariables (void)
ptr1 = ptr1; ptr1 = ptr1;
#elif APP == FONTMERGE #elif APP == FONTMERGE
/* Look for first SEEN !Fonts directory in Font$Path to set Destination */
/* Note this is the LAST one in the path! */
BOOL fonts = FALSE; /* TRUE if/when !Fonts found */
char suffix [9]; /* for compare */
var = getenv ("Font$Path"); var = getenv ("Font$Path");
ptr1 = var + str_len (var);
while (ptr1 > var && *(ptr1 - 1) != ',') ptr1--; if (var != NULL)
/* ptr1 now points at last element of path (ResourceFS) */ {
ptr1--; ptr1 = var + str_len (var); /* => after last char of var */
while (ptr1 > var && *(ptr1 - 1) != ',') ptr1--;
/* ptr1 now points at penultimate element of path (Font$Prefix) */ while (!fonts && ptr1 > var)
ptr0 = ptr1 - 1; {
ptr0 = ptr1;
while (ptr0 > var && *(ptr0 - 1) != ',') ptr0--; while (ptr0 > var && *(ptr0 - 1) != ',') ptr0--;
/* ptr0 now points at the element we want to merge into */ /* ptr0 => start of an element of path */
if (ptr1 - ptr0 <= 2) if (ptr1 - ptr0 > 8)
{
/* Copy last 8 chars of name + terminator */
str_ncpy (suffix, ptr1 - 8, sizeof(suffix));
/* Check for .!Fonts. ignoring case */
if (0 == _swi (Territory_Collate, _INR(0,3)|_RETURN(0), -1, suffix, ".!Fonts.", 1))
fonts = TRUE;
}
if (!fonts) ptr1 = ptr0 - 1; /* => after last char of previous element */
}
}
if (!fonts)
{ {
/* Invalid or no directory */ /* Invalid or no !Fonts directory */
_kernel_oserror e = { 0, "Err_NoFonts" }; _kernel_oserror e = { 0, "Err_NoFonts" };
message_error(messages,e); message_error(messages,e);
} }
else else
{ {
Destination = malloc (ptr1 - ptr0 - 1); Destination = malloc (ptr1 - ptr0);
if (!Destination) message_error(messages,e); if (!Destination) message_error(messages,e);
str_ncpy (Destination, ptr0, ptr1 - ptr0 - 1); /* also remove trailing "." */ str_ncpy (Destination, ptr0, ptr1 - ptr0); /* also remove trailing "." */
} }
#endif #endif
......
...@@ -1038,6 +1038,11 @@ static interr static_DoOp (const char *subpath, operation op, BOOL isfont, BOOL ...@@ -1038,6 +1038,11 @@ static interr static_DoOp (const char *subpath, operation op, BOOL isfont, BOOL
sprintf (command, "Install_LogDir %s", subpath); sprintf (command, "Install_LogDir %s", subpath);
oserror = _swix (OS_CLI, _IN(0), command); oserror = _swix (OS_CLI, _IN(0), command);
err = static_Throw (oserror, subpath); err = static_Throw (oserror, subpath);
strcpy (command, "Install_Log ");
oserror = _swix (MessageTrans_Lookup, _INR(0,7), &messages, "Origin",
command + strlen ("Install_Log "), sizeof (command) - strlen ("Install_Log "),
Source, NULL, NULL, NULL);
if (oserror == NULL) _swix (OS_CLI, _IN(0), command); /* Ignore errors */
break; break;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment