]> git.tdb.fi Git - builder.git/blob - source/filetarget.cpp
Also use file size to determine whether to reinstall a file
[builder.git] / source / filetarget.cpp
1 /* $Id$
2
3 This file is part of builder
4 Copyright © 2009  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include <msp/fs/stat.h>
9 #include <msp/fs/utils.h>
10 #include "file.h"
11
12 using namespace std;
13 using namespace Msp;
14
15 FileTarget::FileTarget(Builder &b, const Package *p, const FS::Path &a):
16         // XXX Builder depends on target name being its path for locating file targets
17         Target(b, p, /*FS::basename*/(a.str())),
18         path(a),
19         size(0)
20 {
21         struct stat st;
22         if(!FS::stat(path, st))
23         {
24                 mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
25                 size=st.st_size;
26         }
27 }