From 74a825e6a0126cf55c90dac183e2c72202a082ea Mon Sep 17 00:00:00 2001 From: Martin Avison <riscos@avisoft.f9.co.uk> Date: Fri, 20 Dec 2024 16:53:38 +0000 Subject: [PATCH] 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' --- Resources/BootMerge/UK/Messages | Bin 733 -> 755 bytes Resources/FontMerge/UK/Messages | Bin 770 -> 792 bytes Resources/SysMerge/UK/Messages | Bin 742 -> 764 bytes VersionNum | 20 +++++++------- c/Main | 45 +++++++++++++++++++++++--------- c/Merge | 5 ++++ 6 files changed, 47 insertions(+), 23 deletions(-) diff --git a/Resources/BootMerge/UK/Messages b/Resources/BootMerge/UK/Messages index 4d43b74254e00e23184eb39c1f5d6df3968ac7da..51fa5141b019c389375466dee9d04318101afce5 100644 GIT binary patch delta 33 ocmcc1`k8fu6O*WaQD%B(o|SKEQF>~MLRwLNu7aw;WJjhs0M6J8l>h($ delta 11 Scmey&dY5&B6Vv1frr7`-^aNJ` diff --git a/Resources/FontMerge/UK/Messages b/Resources/FontMerge/UK/Messages index bc2f4b45d144835749d1661a5c100fda19911495..d47aa0ff1fb21b5350e895549c7ef7ac961c2dac 100644 GIT binary patch delta 33 ocmZo-o58lhkV(|PC^J1X&&oHoC_ObrA+0DsS3%WavH{a20JeP!^#A|> delta 11 ScmbQi*2K2KkZH0z(?tLkhXc0& diff --git a/Resources/SysMerge/UK/Messages b/Resources/SysMerge/UK/Messages index 317e20b6c1f067c8fcb7aa6da3bedd53c97b5e04..a828e7c84fb4faecbed99597c94f80eac65601ad 100644 GIT binary patch delta 33 ocmaFH`iFIcCzGguQD%B(o|SKEQF>~MLRwLNu7aw;WDll!0MYXcw*UYD delta 11 Scmeyv`iymhC)4D3rnvwe=>&NI diff --git a/VersionNum b/VersionNum index 79170f4..4a51cb9 100644 --- a/VersionNum +++ b/VersionNum @@ -1,21 +1,21 @@ -/* (2.11) +/* (2.12) * * 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_Date_CMHG 03 Aug 2024 +#define Module_Date_CMHG 11 Jan 2025 -#define Module_MajorVersion "2.11" -#define Module_Version 211 +#define Module_MajorVersion "2.12" +#define Module_Version 212 #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_FullVersion "2.11" -#define Module_HelpVersion "2.11 (03 Aug 2024)" -#define Module_LibraryVersionInfo "2:11" +#define Module_FullVersion "2.12" +#define Module_HelpVersion "2.12 (11 Jan 2025)" +#define Module_LibraryVersionInfo "2:12" diff --git a/c/Main b/c/Main index 2df9f1e..cb13822 100644 --- a/c/Main +++ b/c/Main @@ -335,27 +335,46 @@ static void static_ReadVariables (void) ptr1 = ptr1; #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"); - ptr1 = var + str_len (var); - while (ptr1 > var && *(ptr1 - 1) != ',') ptr1--; - /* ptr1 now points at last element of path (ResourceFS) */ - ptr1--; - while (ptr1 > var && *(ptr1 - 1) != ',') ptr1--; - /* ptr1 now points at penultimate element of path (Font$Prefix) */ - ptr0 = ptr1 - 1; - while (ptr0 > var && *(ptr0 - 1) != ',') ptr0--; - /* ptr0 now points at the element we want to merge into */ - if (ptr1 - ptr0 <= 2) + + if (var != NULL) + { + ptr1 = var + str_len (var); /* => after last char of var */ + + while (!fonts && ptr1 > var) + { + ptr0 = ptr1; + while (ptr0 > var && *(ptr0 - 1) != ',') ptr0--; + /* ptr0 => start of an element of path */ + 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" }; message_error(messages,e); } else { - Destination = malloc (ptr1 - ptr0 - 1); + Destination = malloc (ptr1 - ptr0); 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 diff --git a/c/Merge b/c/Merge index 893e7e1..52283a8 100644 --- a/c/Merge +++ b/c/Merge @@ -1038,6 +1038,11 @@ static interr static_DoOp (const char *subpath, operation op, BOOL isfont, BOOL sprintf (command, "Install_LogDir %s", subpath); oserror = _swix (OS_CLI, _IN(0), command); 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; } } -- GitLab