From c7d7e761a59f9176b167dfc6dbc6d528cfc589c3 Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Wed, 24 Feb 2016 16:24:09 -0500 Subject: [PATCH] - CMock should now automatically create root mock directory if it doesn't exist (issue #68) --- lib/cmock_file_writer.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/cmock_file_writer.rb b/lib/cmock_file_writer.rb index 867d539..d2d954c 100644 --- a/lib/cmock_file_writer.rb +++ b/lib/cmock_file_writer.rb @@ -2,7 +2,7 @@ # CMock Project - Automatic Mock Generation for C # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams # [Released under MIT License. Please refer to license.txt for details] -# ========================================== +# ========================================== class CMockFileWriter @@ -13,6 +13,10 @@ class CMockFileWriter end def create_subdir(subdir) + if !Dir.exists?("#{@config.mock_path}/") + require 'fileutils' + FileUtils.mkdir_p "#{@config.mock_path}/" + end if subdir && !Dir.exists?("#{@config.mock_path}/#{subdir+'/' if subdir}") require 'fileutils' FileUtils.mkdir_p "#{@config.mock_path}/#{subdir+'/' if subdir}" @@ -28,9 +32,9 @@ class CMockFileWriter end update_file(full_file_name_done, full_file_name_temp) end - + private ################################### - + def update_file(dest, src) require 'fileutils' FileUtils.rm(dest) if (File.exist?(dest))