X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdependencycache.cpp;h=11b200d9983a1ae20056495e101a5f35fe8e2e25;hb=ca18323d45d67243773b03668e79c715aa976441;hp=7505e9889a15154b35a05313f8ed13b7e8db0e13;hpb=409a427f912f9c203b102beed0816b53b250931f;p=builder.git diff --git a/source/dependencycache.cpp b/source/dependencycache.cpp index 7505e98..11b200d 100644 --- a/source/dependencycache.cpp +++ b/source/dependencycache.cpp @@ -1,12 +1,5 @@ -/* $Id$ - -This file is part of builder -Copyright © 2007-2009 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include #include -#include #include #include #include @@ -28,13 +21,14 @@ void DependencyCache::set_deps(const string &tgt, const StringList &d) changed = true; } -const StringList &DependencyCache::get_deps(const string &tgt) const +bool DependencyCache::has_deps(const string &tgt) const { - DepsMap::const_iterator i = deps.find(tgt); - if(i==deps.end()) - throw KeyError("Unknown dependencies", tgt); + return deps.count(tgt); +} - return i->second; +const StringList &DependencyCache::get_deps(const string &tgt) const +{ + return get_item(deps, tgt); } void DependencyCache::save() const @@ -57,7 +51,7 @@ void DependencyCache::load() { string fn = (package.get_source()/".deps").str(); - try + if(FS::Stat st = FS::stat(fn)) { IO::BufferedFile in(fn); @@ -68,8 +62,6 @@ void DependencyCache::load() deps[parts[0]] = StringList(parts.begin()+1, parts.end()); } - mtime = Time::TimeStamp::from_unixtime(FS::stat(fn).st_mtime); + mtime = st.get_modify_time(); } - catch(const IO::file_not_found &) - { } }