]> git.tdb.fi Git - builder.git/blob - source/datacompile.cpp
Improve file target naming
[builder.git] / source / datacompile.cpp
1 #include <msp/fs/dir.h>
2 #include <msp/fs/utils.h>
3 #include "builder.h"
4 #include "component.h"
5 #include "datacompile.h"
6 #include "datafile.h"
7 #include "file.h"
8 #include "sourcepackage.h"
9
10 using namespace Msp;
11
12 DataCompile::DataCompile(Builder &b, ::DataFile &dfile):
13         ExternalAction(b)
14 {
15         const Component &comp = dfile.get_component();
16
17         work_dir = comp.get_package().get_source();
18
19         argv.push_back("mspdatatool");
20         argv.push_back("-c");
21         argv.push_back("-b");
22
23         FS::Path opath = dfile.get_path();
24         argv.push_back("-o");
25         argv.push_back(relative(opath, work_dir).str());
26
27         FS::Path spath = dfile.get_source().get_path();
28         argv.push_back(relative(spath, work_dir).str());
29
30         if(!builder.get_dry_run())
31                 FS::mkpath(FS::dirname(opath), 0755);
32
33         announce(comp.get_package().get_name(), "DATA", relative(opath, work_dir).str());
34
35         launch();
36 }