From 618c9ff223369f6061776490d872d717bd85e104 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 1 Jun 2013 16:03:37 -0400 Subject: bugfix: dxf_cross() on file-not-found diff --git a/src/dxfdim.cc b/src/dxfdim.cc index 66842d2..a241b87 100644 --- a/src/dxfdim.cc +++ b/src/dxfdim.cc @@ -160,9 +160,16 @@ Value builtin_dxf_cross(const Context *ctx, const EvalContext *evalctx) } std::stringstream keystream; + fs::path filepath(filename); + uintmax_t filesize = -1; + time_t lastwritetime = -1; + if (fs::exists(filepath) && fs::is_regular_file(filepath)) { + filesize = fs::file_size(filepath); + lastwritetime = fs::last_write_time(filepath); + } keystream << filename << "|" << layername << "|" << xorigin << "|" << yorigin - << "|" << scale << "|" << fs::last_write_time(filename) - << "|" << fs::file_size(filename); + << "|" << scale << "|" << lastwritetime + << "|" << filesize; std::string key = keystream.str(); if (dxf_cross_cache.find(key) != dxf_cross_cache.end()) -- cgit v0.10.1