General formatting and cleanup.

This commit is contained in:
Ottermandias 2021-07-26 16:17:20 +02:00
parent 2b46397e8e
commit 12ee42df8e
29 changed files with 289 additions and 197 deletions

View file

@ -5,13 +5,14 @@ namespace Penumbra.Util
{
public static class TempFile
{
public static FileInfo TempFileName( DirectoryInfo baseDir, string suffix = "")
public static FileInfo TempFileName( DirectoryInfo baseDir, string suffix = "" )
{
const uint maxTries = 15;
for( var i = 0; i < maxTries; ++i )
{
var name = Path.GetRandomFileName();
var path = new FileInfo( Path.Combine( baseDir.FullName, suffix.Any() ? name.Substring( 0, name.LastIndexOf( '.' ) ) + suffix : name ) );
var path = new FileInfo( Path.Combine( baseDir.FullName,
suffix.Any() ? name.Substring( 0, name.LastIndexOf( '.' ) ) + suffix : name ) );
if( !path.Exists )
{
return path;