Skip to content

Commit 73f3faf

Browse files
committed
docparser: recursively create directories
If we want file a/b/c.h we want to make sure that we create a/ and a/b/ which Dir.mkdir doesn't do for us. Use FileUtils.mkdir_p instead.
1 parent e152c49 commit 73f3faf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/docurium/docparser.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'tempfile'
2+
require 'fileutils'
23
require 'ffi/clang'
34
include FFI::Clang
45

@@ -17,7 +18,7 @@ def parse_file(orig_filename, files)
1718
unsaved = files.map do |name, contents|
1819
full_path = File.join(tmpdir, name)
1920
dirname = File.dirname(full_path)
20-
Dir.mkdir(dirname) unless Dir.exists? dirname
21+
FileUtils.mkdir_p(dirname) unless Dir.exists? dirname
2122
File.new(full_path, File::CREAT).close()
2223

2324
UnsavedFile.new(full_path, contents)

0 commit comments

Comments
 (0)