FAES/Utilities/FileAES_IntUtilities.cs
/// <summary>
/// Safely deletes a file by ensure it exists before deletion
/// </summary>
/// <param name="path">Path to file</param>
/// <returns>If the file is deleted</returns>
Safely deletes a file by ensure it exists before deletion
Safely deletes a file by ensure it exists before deletion
internal static bool SafeDeleteFile(string path)
        {
            if (File.Exists(path))
            {
                try
                {
                    File.Delete(path);
                    Logging.Log($"SafeDeleteFile: {path}", Severity.DEBUG);
                    return true;
                }
                catch
                {
                    throw new UnauthorizedAccessException("Error occurred in SafeDeleteFile. File cannot be deleted!");
                }
            }
            return false;
        }
internal static bool SafeDeleteFile ( string path ) { if ( File . Exists ( path ) ) { try { File . Delete ( path ) ; Logging . Log ( $" SafeDeleteFile:  { path } " , Severity . DEBUG ) ; return true ; } catch { throw new UnauthorizedAccessException ( " " ) ; } } return false ; }
Safely deletes a file by ensure it exists before deletion
Safely deletes a file by ensure it exists before deletion
If the file is deleted
If the file is deleted
path
string
Path to file
Path to file