AwbUpdater.Updater.DeleteIfExists C# (CSharp) Method

DeleteIfExists() private method

private DeleteIfExists ( string name ) : void
name string
return void
        private void DeleteIfExists(string name)
        {
            string path = Path.Combine(_awbDirectory, name);
            while (true)
            {
                try
                {
                    DeleteAbsoluteIfExists(path);
                }
                catch (UnauthorizedAccessException) //The exception that is thrown when the operating system denies access because of an I/O error or a specific type of security error.
                {
                    MessageBox.Show(this,
                        "Access denied for deleting files. Program Files and such are not the best place to run AWB from.\r\n" +
                        "Please run the updater with Administrator rights.");
                    Fail();
                }
                catch (Exception ex)
                {
                    if (MessageBox.Show(
                        this,
                        "Problem deleting file:\r\n   " + ex.Message + "\r\n\r\n" +
                        "Please close all applications that may use it and press 'Retry' to try again " +
                        "or 'Cancel' to cancel the upgrade.",
                        "Error",
                        MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Retry)
                    {
                        continue;
                    }

                    Fail();
                }

                break;
            }
        }