summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-06-01 20:03:37 (GMT)
committerMarius Kintel <marius@kintel.net>2013-06-01 20:03:37 (GMT)
commit618c9ff223369f6061776490d872d717bd85e104 (patch)
treeb42c19cd80ce206a7002d7611d4bba6b4573c9c8
parent31b234140dba2e919113a521c1b3c2131eea075c (diff)
bugfix: dxf_cross() on file-not-found
-rw-r--r--src/dxfdim.cc11
1 files changed, 9 insertions, 2 deletions
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())
contact: Jan Huwald // Impressum