1 /**
2  * 7-Zip command-line installer
3  *
4  * License:
5  *   This Source Code Form is subject to the terms of
6  *   the Mozilla Public License, v. 2.0. If a copy of
7  *   the MPL was not distributed with this file, You
8  *   can obtain one at http://mozilla.org/MPL/2.0/.
9  *
10  * Authors:
11  *   Vladimir Panteleev <vladimir@thecybershadow.net>
12  */
13 
14 module ae.sys.install.sevenzip;
15 
16 import std.array;
17 import std.file;
18 import std.path;
19 
20 import ae.sys.archive;
21 import ae.sys.file;
22 import ae.utils.array;
23 import ae.utils.meta.misc;
24 import ae.utils.xmllite;
25 
26 public import ae.sys.install.common;
27 
28 class SevenZip : Installer
29 {
30 	string url = "http://downloads.sourceforge.net/sevenzip/7za920.zip";
31 
32 	@property override string name() { return "7-Zip"; }
33 	@property override string subdirectory() { return "7z"; }
34 
35 	@property override string[] requiredExecutables() { assert(false); }
36 
37 	override void installImpl(string target)
38 	{
39 		windowsOnly();
40 		url
41 			.I!save()
42 			.I!unpackTo(target);
43 	}
44 
45 	@property override bool availableOnSystem()
46 	{
47 		return haveExecutable("7z") || haveExecutable("7za");
48 	}
49 
50 	@property string exe()
51 	{
52 		if (haveExecutable("7za"))
53 			return "7za";
54 		else
55 			return "7z";
56 	}
57 }
58 
59 alias sevenZip = singleton!SevenZip;