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 ae.utils.meta : singleton, I;
17 
18 public import ae.sys.install.common;
19 
20 class SevenZipInstaller : Installer
21 {
22 	string url = "http://downloads.sourceforge.net/sevenzip/7za920.zip";
23 
24 	@property override string name() { return "7-Zip"; }
25 	@property override string subdirectory() { return "7z"; }
26 
27 	@property override string[] requiredExecutables() { assert(false); }
28 
29 	import ae.utils.path : haveExecutable;
30 
31 	override void installImpl(string target)
32 	{
33 		windowsOnly();
34 		url
35 			.I!save()
36 			.I!unpackTo(target);
37 	}
38 
39 	@property override bool availableOnSystem()
40 	{
41 		return haveExecutable("7z") || haveExecutable("7za");
42 	}
43 
44 	@property string exe()
45 	{
46 		if (haveExecutable("7za"))
47 			return "7za";
48 		else
49 			return "7z";
50 	}
51 
52 	static this()
53 	{
54 		urlDigests["http://downloads.sourceforge.net/sevenzip/7za920.zip"] = "9ce9ce89ebc070fea5d679936f21f9dde25faae0";
55 	}
56 }
57 
58 alias sevenZip = singleton!SevenZipInstaller;