Method: PDK::Module::UpdateManager#unlink_file
- Defined in:
- lib/pdk/module/update_manager.rb
#unlink_file(path) ⇒ Object
Remove a file from disk.
Like FileUtils.rm_f, this method will not fail if the file does not exist. Unlike FileUtils.rm_f, this method will not blindly swallow all exceptions.
130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/pdk/module/update_manager.rb', line 130 def unlink_file(path) require 'pdk/util/filesystem' if PDK::Util::Filesystem.file?(path) PDK.logger.debug(format("unlinking '%{path}'", path: path)) PDK::Util::Filesystem.rm(path) else PDK.logger.debug(format("'%{path}': already gone", path: path)) end rescue StandardError => e raise PDK::CLI::ExitWithError, format("Unable to remove '%{path}': %{message}", path: path, message: e.) end |