lib/common/utils.rb in bake-toolkit-2.63.1 vs lib/common/utils.rb in bake-toolkit-2.63.2

- old
+ new

@@ -2,14 +2,24 @@ module Bake module Utils - def self.gitIgnore(folder) - FileUtils::mkdir_p(folder) + def self.gitIgnore(folder, mode = :report) gitignore = folder + "/.gitignore" - if !File.exist?(gitignore) - File.write(gitignore, ".\n") + begin + FileUtils::mkdir_p(folder) + if !File.exist?(gitignore) + File.write(gitignore, ".\n") + end + rescue Exception=>e + if mode != :silent && Bake.options.verbose >= 3 + Bake.formatter.printWarning("Warning: Could not write file #{gitignore}") + if Bake.options.debug + puts e.message + puts e.backtrace + end + end end end def self.flagSplit(str, removeQuotes) return [] if str == ""