class TyranoDsl::ExportGame::FileActions::ClearDirectory

Remove all files from a directory

Attributes

path[R]

@return [String]

Public Class Methods

new(path) click to toggle source

@param [String] path

# File lib/tyrano_dsl/export_game/file_actions/clear_directory.rb, line 15
def initialize(path)
  @path = path
  log {to_s}
end

Public Instance Methods

run(tyrano_project_path) click to toggle source

@param [String] tyrano_project_path @return [void]

# File lib/tyrano_dsl/export_game/file_actions/clear_directory.rb, line 22
def run(tyrano_project_path)
  full_path = File.join(tyrano_project_path, path)
  log {"Cleaning [#{full_path}]"}
  if File.exists? full_path
    FileUtils.remove_entry full_path
  end
  FileUtils.mkdir_p full_path
end
to_s() click to toggle source
# File lib/tyrano_dsl/export_game/file_actions/clear_directory.rb, line 31
def to_s
  "Clear directory [#{path}]"
end