Differences between revisions 3 and 60 (spanning 57 versions)
Revision 3 as of 2007-03-10 22:42:59
Size: 2740
Editor: KaiJaeger
Comment:
Revision 60 as of 2014-01-10 11:51:39
Size: 1563
Editor: KaiJaeger
Comment: New version
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= SevenZip =
{{{SevenZip}}} is part of the CategoryAplTree project.

<<TableOfContents>>

== Warning ==

Note that 7zip issues an error when you pass something like this with the flag to preserve the directory structure:

{{{
C:\My\folder1\file.txt
C:\My\folder2\file.txt
}}}

This is a clearly a bug. However, you can easily get around this by executing the command within `C:\My` and this list of files:
{{{
folder1\file.txt
folder2\file.txt
}}}

In other words: relative paths are fine, absolute ones are not.

Since version 1.1.0 the `SevenZip` class issues in hint if this error occurs and absolute path names are used.
Line 3: Line 27:
INI files are still useful to provide settings to an application. Vista is not going to change this.
The Windows API methods provided to read a particular value have an advantage: they follow a clearly defined search path, and following that path they take not only the INI file into account, they also check the Windows registry and the command line parameter. Furthermore, they deliver always up-to-date values.
The class "SevenZip" relies on an installed version of the Open Source zipper [[http://www.7-zip.org/ | 7zip]].
Line 6: Line 29:
They have a disadvantage as well: they are slow. The class makes it very easy to zip as well as unzip stuff.
Line 8: Line 31:
If you are not interested in the Windows registry and command line parameters, and if you are not changing your INI files while the application is running, then the "!IniFile" class introduced in this article might attract your attention. "SevenZip" suppports the following formats:
 * 7z
 * split
 * zip
 * gzip
 * bzip2
 * tar
Line 10: Line 39:
This class allows you to use a kind of APL-Syntax in your INI files. You can either specify an appropriate extension or set the "type" property in order to enforce a certain format.
Line 12: Line 41:
== Details ==

An entry like:

{{{HomeFolder='C:/Windows/Appl/'}}}

results in a string holding the path, but an entry like:

{{{FormSize=300 400}}}

results in a two-element-vector "!FormSize" holding two Integers.

Furthermore, an entry like:

{{{LogFolder='{"HomeFolder}Logsfiles/'}}}

is treated in a special way: the name between the curlies is treated as the name of an alreday defined value in the same section. It is then replaced by the value of that entry.

After creating an instance from the class:

{{{MyIni←⎕New #.IniClass 'C:/Appl/Example.ini'}}}

you can get all information you are interested in by calling the only method "Get". Given this file "Example.ini":
Line 36: Line 42:
[GENERAL]
MaxNoOfErrors=20
FormSize=800 1200
LogfileFlag=1
LogLevels=1 2 3 * from 1 to 9

[DIR]
Home='C:/mainfolder/'
AppFolder='{Home}appls/'
DocsFolder='{Home}docs/'
LogFileFolder='{Home}Logs/'
      myZipper←⎕new #.SevenZip (,⊂'MyZipFile')
      ⎕←myZipper
[SevenZip@MyZipFile]
      myZipper.Add 'foo.txt'
      ⎕←myZipper.List 0
foo.txt
myZipper.Unzip 'c:\output\'
Line 49: Line 51:
You can get any level of information you are interested in: == Project Page ==
Line 51: Line 53:
 * list everything
 * list a particular section
 * list a particular value in a particular section
For bug reports, future enhancements and a full version history see SevenZip/ProjectPage
Line 55: Line 55:
== Examples == == Version Information ==
||Original author: ||KaiJaeger ||
||Responsible: ||KaiJaeger ||
||Email: || kai@aplteam.com ||
Line 57: Line 60:
{{{
      MyIni.Get ⍬ ⍬
GENERAL MaxNoOfErrors 20
GENERAL FormSize 800 1200
GENERAL LogfileFlag 1
GENERAL LogLevels 1 2 3
DIR Home C:/mainfolder/
DIR AppFolder C:/mainfolder/appls/
DIR DocsFolder C:/mainfolder/docs/
DIR LogFileFolder C:/mainfolder//Logs/
      MyIni.Get'General' ⍬
MaxNoOfErrors 20
FormSize 800 1200
LogfileFlag 1
LogLevels 1 2 3
      MyIni.Get'General' 'FormSize'
800 1200
      MyIni.Get'General' 'Unknown'
<<Include(APLTreeDownloads)>>
Line 76: Line 62:
      ¯1 MyIni.Get'General' 'Unknown'
¯1
      ¯1 MyIni.Get'Dir' 'LogFileFolder'
C:/mainfolder/Logs/
}}}

>> [:IniFiles/Script:The Script]

Kai Jaeger
Line 86: Line 63:
CategoryDyalog CategoryScripts CategoryAplTree

SevenZip

SevenZip is part of the CategoryAplTree project.

Warning

Note that 7zip issues an error when you pass something like this with the flag to preserve the directory structure:

C:\My\folder1\file.txt
C:\My\folder2\file.txt

This is a clearly a bug. However, you can easily get around this by executing the command within C:\My and this list of files:

folder1\file.txt
folder2\file.txt

In other words: relative paths are fine, absolute ones are not.

Since version 1.1.0 the SevenZip class issues in hint if this error occurs and absolute path names are used.

Overview

The class "SevenZip" relies on an installed version of the Open Source zipper 7zip.

The class makes it very easy to zip as well as unzip stuff.

"SevenZip" suppports the following formats:

  • 7z
  • split
  • zip
  • gzip
  • bzip2
  • tar

You can either specify an appropriate extension or set the "type" property in order to enforce a certain format.

      myZipper←⎕new #.SevenZip (,⊂'MyZipFile')
      ⎕←myZipper
[SevenZip@MyZipFile]
      myZipper.Add 'foo.txt'
      ⎕←myZipper.List 0
foo.txt
myZipper.Unzip 'c:\output\'

Project Page

For bug reports, future enhancements and a full version history see SevenZip/ProjectPage

Version Information

Original author:

KaiJaeger

Responsible:

KaiJaeger

Email:

kai@aplteam.com


CategoryAplTree

SevenZip (last edited 2018-03-03 11:38:43 by KaiJaeger)