From 4209fdaafcd50ba4be40ee0d4bc96ed3ecf363d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Fri, 4 Dec 2015 17:10:57 -0500 Subject: [PATCH] Implemented WindowsFile#exist? It was missing and not raising an error, which caused much confusion. See https://github.com/chef/inspec/issues/288 for more info. --- lib/train/extras/windows_file.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/train/extras/windows_file.rb b/lib/train/extras/windows_file.rb index 0236becf..8d5283af 100644 --- a/lib/train/extras/windows_file.rb +++ b/lib/train/extras/windows_file.rb @@ -26,7 +26,9 @@ def content end def exist? - nil + return @exist if defined?(@exist) + @exist = @backend.run_command( + "(Test-Path -Path \"#{@spath}\").ToString()").stdout.chomp == 'True' end def link_target