- CMock should now automatically create root mock directory if it doesn't exist (issue #68)

This commit is contained in:
Mark VanderVoord
2016-02-24 16:24:09 -05:00
parent 581642e08c
commit c7d7e761a5
+7 -3
View File
@@ -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))