This commit is contained in:
CortexCore
2024-03-31 23:31:00 +08:00
parent e179d2eb53
commit b7b89ee71a
641 changed files with 31286 additions and 22134 deletions

View File

@@ -35,7 +35,7 @@ namespace BITKit
public static void EnsureDirectoryCreated(string path)
{
path = Path.GetDirectoryName(path);
if (Directory.Exists(path) is true) return;
if (Directory.Exists(path)) return;
if (path != null) Directory.CreateDirectory(path);
}
@@ -44,21 +44,17 @@ namespace BITKit
var path = GetPath(paths);
var dictionaryPath = Path.GetDirectoryName(path);
Directory.CreateDirectory(dictionaryPath);
if (File.Exists(path) is false)
{
using (var fs = File.Create(path))
{
fs.Close();
fs.Dispose();
}
}
if (File.Exists(path)) return path;
using var fs = File.Create(path);
fs.Close();
fs.Dispose();
return path;
}
public static string GetTempFilePath(string fileName = null)
{
var path = GetFilePath("Temps", fileName is null ? Guid.NewGuid().ToString() : fileName);
var path = GetFilePath("Temps", fileName ?? Guid.NewGuid().ToString());
return path;
}