External archivers


Content
1.1. Multiarc.ini reference
1.2. Format parsing
1.3. Command definition format

Double Commander uses principle of the work with external arhivers similar to plugin MultiArc for Total Commander. Most of the explanations are from the help file for this plugin.


Multiarc.ini reference

All settings of external archivers is stored in multiarc.ini file. This file is standard INI-file. It contains some sections. Those sections contains keys - the pairs of strings separated by equality sign. Those files is text files and can be edited by every text editor. Every archiver, supported by DC must be described as a separate section in multiarc.ini. See below for detailed info about its structure. There is also special section with name "MultiArc". This sections contains settings that applicable for all archivers - i.e. general settings

The structure of typical archiver description section: 

[TypeName]

Parameter = Value of parameter

Pattern = String representing a pattern

Command = String representing a command

Flag = 0 or 1 depending on state of this flag

TypeName is a short name for archive type. It is required and must be unique.

Example:

[ARJ]

Parameters

Archiver Path to archiver utilit. Pach can contain enviropment variable such as %WINDIR% or %COMMANDER_PATH%.

ID (optional) archive ID (2-digit hex numbers delimited with spaces).

IDPos (optional) ID position in archive. If not present, ID will be searched in starting part of archive. You can define the positions with "-" sign. In this case the positions will be calculated from end of file. Special value <SeekID> determinated search ID if not found by numeric values of IDPos. Seek in range 0 - (Smalest of Size of file or IDSeekRange). Values can be writed as decimal (12345) or heximal (03039). For negative values use notation 0xFFFFFFFF (-1).

IDSeekRange (optional) count of bytes where ID seek if defined <SeekID>. By default IDSeekRange = 1Mb. See IDPOS.

Extension archive format extension (without dot).

Note:All above parameters can be defined with multiple values. You can use comma to separate those multiple values.

Description archive description. A short string - version, author etc.

Example:

ID = 00 FF, CC DD, 55 EF 32 12,

IDPos = 0, 0xd, -6, <SeekID>

Extension = hhh, hpj, tzu

Description="PivkARC v7.1365 (c) by Kon' Petrovich"

The archives in this example will be checked in the following manner.

Set to pos 0 and check for every ID defined in ID parameter. Than go to pos 13 and check for all IDs again and try will be at pos 6 before the end of file and last try find IDs in range 0--SizeOfFile or 0--IDSeekRange, or 0--1Mb. If at some of this checks the file will contains some of ID this file will be assumed as supported by this archiver.

Patterns

Start(optional) any part of line in listing after which processing

End (optional) any part of line in listing to stop processing of files list.

Note for Start and End patterns: If text started from '^', it will be compared from second symbol with lines beginning. Otherwise text looked anywhere in lines.

Format0 ... Format<n> - files listing format. If file description in archive listing contains multiple lines use corresponding format keys count. You can define up to 50 format lines.

Format strings description   

Example:

Start="^-------"

End="^Total files listed: "

Format1="zzzzzzzzzz aaaaa                        yyyy tt dd hh mm ss"

Format2=" "

Commands

List - produce listing.

Extract - extract file(s) from archive with full path.

ExtractWithoutPath - extract file(s) from archive without full path.

Test - test archive.

Delete - delete file from archive.

Add - add file to archive.

AddSelfExtract - create self extracting archive.

InputString - insert some string into archivers utility input stream. This is used to emulate pressing some keys at start of archiver. Used for some shareware utilities that requires press Y before work. =-)

Note: All command excluding InputString use command definition format  

Flags

IgnoreErrors if active - archiver commands exit code will be ignored. Use with caution.

SkipEmpty files with empty names will not be added to list

FormMode format parsing mode, it is the sum of the following values:

  1 - use Unix path delimiter (/)

  2 - use Windows path delimiter (\)

  4 - use Unix file attributes

  8 - use Windows file attributes

Debug if this flag activated - all archiving utility output will be written to log file, laying in same directory as multiarc.wcx and named "multiarc.%TYPENAME%.log" where %TYPENAME% is TypeName of corresponding archiver description. If some list files used in commands, those files also will be not removed after performing command. Look into %TEMP%/$mltwcx directory for those files. Activate this flag only if you going to track all activity. It is needed during writing new addons. Do not use it if you not need it! This log file can eat your free disk space very quick! =-) You warned.

 





Format parsing

To parse file listing MultiArc uses FormatN-pattern. If file list uses some strings to output information about every file in the archive use corresponding count of Format-patterns. The Format-pattern is a string defining mask for extraction information from single strings of files list. It uses following symbols to define pattern: 

;  n - file name

;  z - unpacked size

;  c - file description

;  p - packed size

;  d - day

;  t - month

;  TTT - three letters month name (Jan, Feb, Mar, ...)

;  y - year

;  h - hours

;  H - hours modifier letter (a - a.m. time, p - p.m. time)

;  m - minutes

;  s - seconds

;  a - attributes

;  e - file extension

;  ? - skip one symbol

;  * - skip until first space or end of line

Example:

The part of JAR output log:

346) install\f_0286

      3656 A.... Win-32  Solid    1-1   2002-07-11 13:36:26 2002-12-09 20:41:20

                           26                               2002-12-09 00:00:00

347) install\f_0287

     11323 A.... Win-32  Solid    1-1   2002-07-11 13:36:26 2002-12-09 20:41:20

                           26                               2002-12-09 00:00:00

and corresponding format patterns:

Format0="* nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"

Format1="zzzzzzzzzz aaaaa                        yyyy tt dd hh mm ss"

Format2=" "

 





Command definition format

Command is string that contains variables. Those variables has the "%"-sign before them and will be substituted during command call. 

The list of command variables:


  %P - long name of archiving utility (as it is in "Archiver" key)

  %p - short name of archiving utility (as it is in "Archiver" key)

  %A - long name of archive file

  %a - short name of archive file

  %L - Filelist name. Filelist is the file containing names of files

       to be processed by the external archiver. File names is long

  %l - Filelist with short file names.

  %F - The name of a single file to process. The archiver will be

       executed several times until all file names are exhausted.

       This variable should be used only if the destination archiver

       does not support filelists on the command line.

  %V - The volume size (for multivolume archive).

  %W - The password.

  %E<errorlevel> - maximum acceptable command errorlevel.

       For example, %E2 indicates that errorlevels 0, 1 and 2

       are acceptable. This variable may be specified in any place

       of command. If it is absent, only errorlevel 0 is considered

       as successful.

  %O - by default, multiarc convert archiver output from OEM encoding to ANSI.

       Applying it skip encoding.


  %R - Target subdirectory IN archive


  {} - if some variable is enclosed in braces - it'll be added only if

       this variable will contain something non-empty. See MsCAB addon

       for example using.

 

  %S - Depends on modes, set in configuration dialog, MultiArc will ask

       user about additional command-line parameters should be passed

       in-place of %S



  Variable modifiers F, Q, q, W, P, A, U can be used to change file names

  format details:


  F - include in FileList only files (can be used with %L and %l variables);

  Q - quote names with spaces;

  q - quote all names;

  W - use name only, without path;

  P - use path only, without name;

  A - use ANSI encoding.

  U - use UTF-8 encoding.


  These modifiers may be specified immediately after variables without

  spaces.

See the addons for real examples of commands.

Note:

If archiver utility located in path with non English chars, and you see message like this:

"Executing command 'C:\Documents and Settings\ a(r)\ ?(r)c?(c) aa(r)"\7za.exe -r0 l D:\same path\7zSfx.7z' returned errorlevel -1. Possibly an error occurred. Archive listing wasn't retrieved."

or like this:

"Executed command 'C:\Documents and Settings\ a(r)\ ?(r)c?(c) aa(r)"\7za.exe -r0 l D:\same path\7zSfx.7z' returned errorlevel -1, which is higher than configured as normal for this command. Probably error occurred. Check your configuration, please..."

Replace in Multiarc.ini on section appropriate archiver parameters Extract, ExtractWithoutPath, Test, Delete, Add from %P to %PA or %PQA.