From 1992bb054abd0cba5d155d85a81ce9302fa5587f Mon Sep 17 00:00:00 2001 From: Eli Belash Date: Wed, 21 Aug 2019 15:55:07 +0300 Subject: [PATCH] gfile.cs, Walk(...): Handle case when directory top doesn't exist. --- src/TensorFlowNET.Core/IO/gfile.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/TensorFlowNET.Core/IO/gfile.cs b/src/TensorFlowNET.Core/IO/gfile.cs index 930dd652..a7303bf6 100644 --- a/src/TensorFlowNET.Core/IO/gfile.cs +++ b/src/TensorFlowNET.Core/IO/gfile.cs @@ -16,6 +16,7 @@ using System.Collections.Generic; using System.IO; +using System.Linq; namespace Tensorflow.IO { @@ -28,6 +29,9 @@ namespace Tensorflow.IO /// Traverse in order if True, post order if False. public IEnumerable<(string, string[], string[])> Walk(string top, bool in_order = true) { + if (!Directory.Exists(top)) + return Enumerable.Empty<(string, string[], string[])>(); + return walk_v2(top, in_order); }