From 17471eab65194bdc83549d195d4f15c4688fbe6e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 12 Jul 2015 17:13:31 +0200 Subject: [PATCH] Topic generation: Accept non-existing output directory --- Tools/px_generate_uorb_topic_headers.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Tools/px_generate_uorb_topic_headers.py b/Tools/px_generate_uorb_topic_headers.py index 6be0e19163..f1b2ff9ae0 100755 --- a/Tools/px_generate_uorb_topic_headers.py +++ b/Tools/px_generate_uorb_topic_headers.py @@ -105,12 +105,13 @@ def convert_dir(inputdir, outputdir, templatedir): # Find the most recent modification time in output dir maxouttime = 0 - for f in os.listdir(outputdir): - fni = os.path.join(outputdir, f) - if os.path.isfile(fni): - it = os.path.getmtime(fni) - if it > maxouttime: - maxouttime = it; + if os.path.isdir(outputdir) + for f in os.listdir(outputdir): + fni = os.path.join(outputdir, f) + if os.path.isfile(fni): + it = os.path.getmtime(fni) + if it > maxouttime: + maxouttime = it; # Do not generate if nothing changed on the input if (maxinputtime != 0 and maxouttime != 0 and maxinputtime < maxouttime):