dev0 пускается с ключом BB_PACKED_FIRST. Не надо поддерживать отдельную копию HostPackedFiles -- HostDevPackedFiles.
Код:
exe="dev0"
# export LD_DEBUG=all
exec env \
BB_PRIMARY_DIR="${pd}" BB_SECONDARY_DIR="${sd}" \
BB_PACKED_NAME="${exe}" BB_PACKED_FIRST= \
"${pd}"/${exe} "${@}"
Реализация для линуха ниже, для винды изменения аналогичные. HostConf -- см.
viewtopic.php?t=6557Код:
MODULE HostPackedFiles;
...
IMPORT SYSTEM, Files, HostFiles (*, Dialog*), Libc := LinLibc, HostConf;
...
VAR
packedFirst: BOOLEAN;
...
PROCEDURE (d: Directory) Old (loc: Files.Locator; name: Files.Name; shared: BOOLEAN): Files.File;
VAR f: Files.File;
BEGIN
IF packedFirst THEN
f := packedDir.Old(loc, name, shared);
IF f = NIL THEN f := orgdir.Old(loc, name, shared) END;
ELSE
f := orgdir.Old(loc, name, shared);
IF f = NIL THEN f := packedDir.Old(loc, name, shared) END;
END;
RETURN f
END Old;
...
PROCEDURE Init;
VAR loc: Files.Locator; appName: Files.Name; pDir: PackedDirectory; sDir: Directory;
buf: ARRAY 2 OF CHAR; res: INTEGER;
BEGIN
HostConf.GetPar("BB_PACKED_FIRST", buf, res); packedFirst := res = 0;
HostConf.GetPar("BB_PACKED_NAME", appName, res);
IF res = 2 THEN
Msg("HostPackedFiles: BB_PACKED_NAME parameter not specified")
ELSIF res IN {1, 3} THEN
Msg("HostPackedFiles: failed to get BB_PACKED_NAME")
ELSE
loc := Files.dir.This(""); Files.dir.GetFileName(appName, "", appName);
exefile := Files.dir.Old(loc, appName, Files.shared);
IF (exefile # NIL) & (loc IS HostFiles.Locator) THEN
curloc := loc(HostFiles.Locator);
ReadResourceTable;
NEW(pDir); packedDir := pDir; NEW(sDir); stdDir := sDir;
SetFilesDir
ELSE
DebugPrint("HostPackedFiles: Could not open " + appName)
END
END
END Init;
...