47 lines
1.4 KiB
D
47 lines
1.4 KiB
D
|
|
module prebuild;
|
||
|
|
|
||
|
|
import std;
|
||
|
|
|
||
|
|
|
||
|
|
void exec(string[] args)
|
||
|
|
{
|
||
|
|
auto res = execute(args);
|
||
|
|
if (res.status == 0)
|
||
|
|
return;
|
||
|
|
writeln(res.output);
|
||
|
|
throw new Exception("Command failed");
|
||
|
|
}
|
||
|
|
|
||
|
|
void main()
|
||
|
|
{
|
||
|
|
// Generate icon file
|
||
|
|
exec([
|
||
|
|
"magick",
|
||
|
|
"views/res/img/icon.png",
|
||
|
|
"-alpha", "on",
|
||
|
|
"-background", "transparent",
|
||
|
|
"(", "-clone", "0", "-scale", "16x16", "-extent", "16x16", ")",
|
||
|
|
"(", "-clone", "0", "-scale", "32x32", "-extent", "32x32", ")",
|
||
|
|
"(", "-clone", "0", "-scale", "48x48", "-extent", "48x48", ")",
|
||
|
|
"(", "-clone", "0", "-scale", "64x64", "-extent", "64x64", ")",
|
||
|
|
"(", "-clone", "0", "-scale", "96x96", "-extent", "96x96", ")",
|
||
|
|
"(", "-clone", "0", "-scale", "128x128", "-extent", "128x128", ")",
|
||
|
|
"(", "-clone", "0", "-scale", "256x256", "-extent", "256x256", ")",
|
||
|
|
"-delete", "0",
|
||
|
|
"-colors", "256",
|
||
|
|
"views/res/img/icon.ico",
|
||
|
|
]);
|
||
|
|
|
||
|
|
// Generate resource file
|
||
|
|
exec(["rc", "/fo", "medimancer.res", "views\\res\\res.rc"]);
|
||
|
|
|
||
|
|
// Generate resources.list
|
||
|
|
string view = absolutePath("views\\");
|
||
|
|
File resources = File(buildPath(view, "resources.list"), "w");
|
||
|
|
foreach (entry; dirEntries(buildPath(view, "res"), SpanMode.breadth))
|
||
|
|
{
|
||
|
|
if (!entry.isFile)
|
||
|
|
continue;
|
||
|
|
resources.writeln(asRelativePath(entry, view).array.replace('\\', '/'));
|
||
|
|
}
|
||
|
|
}
|