From eac1663fed840737189f903ed763553a724f0174 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Thu, 21 May 2015 00:40:49 -0500 Subject: [PATCH] Ensure that the base directory exists before creating the file --- lib/rex/json_hash_file.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rex/json_hash_file.rb b/lib/rex/json_hash_file.rb index 196c5aadbb..00556efdfe 100644 --- a/lib/rex/json_hash_file.rb +++ b/lib/rex/json_hash_file.rb @@ -1,6 +1,7 @@ # -*- coding => binary -*- require 'json' +require 'fileutils' # # This class provides a thread-friendly hash file store in JSON format @@ -15,6 +16,7 @@ class JSONHashFile @lock = Mutex.new @hash = {} @last = 0 + ::FileUtils.mkdir_p(::File.dirname(path)) synced_update end