Skip to content

Commit eac1663

Browse files
author
HD Moore
committed
Ensure that the base directory exists before creating the file
1 parent 4622fa6 commit eac1663

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/rex/json_hash_file.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding => binary -*-
22

33
require 'json'
4+
require 'fileutils'
45

56
#
67
# This class provides a thread-friendly hash file store in JSON format
@@ -15,6 +16,7 @@ def initialize(path)
1516
@lock = Mutex.new
1617
@hash = {}
1718
@last = 0
19+
::FileUtils.mkdir_p(::File.dirname(path))
1820
synced_update
1921
end
2022

0 commit comments

Comments
 (0)