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.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/pdk/module/update_manager.rb', line 114 def unlink_file(path) require 'pdk/util/filesystem' if PDK::Util::Filesystem.file?(path) PDK.logger.debug(_("unlinking '%{path}'") % { path: path }) PDK::Util::Filesystem.rm(path) else PDK.logger.debug(_("'%{path}': already gone") % { path: path }) end rescue => e raise PDK::CLI::ExitWithError, _("Unable to remove '%{path}': %{message}") % { path: path, message: e., } end |