This commit is contained in:
2025-08-22 23:35:56 +08:00

View File

@@ -1022,25 +1022,28 @@ namespace CheckDownload
/// <summary>
/// 初始化程序使用的临时目录,用于存储下载过程中的临时文件
/// </summary>
private void InitializeTempDirectory()
{
try
{
_tempDirectory = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"Temp",
_appName
);
if (!Directory.Exists(_tempDirectory))
{
Directory.CreateDirectory(_tempDirectory);
}
}
catch (Exception ex)
{
throw new Exception("初始化临时目录 (InitializeTempDirectory)", ex);
}
private void InitializeTempDirectory()
{
try
{
string exeDir = AppDomain.CurrentDomain.BaseDirectory;
_tempDirectory = Path.Combine(exeDir, "Temp");
if (File.Exists(_tempDirectory))
{
throw new IOException($"无法创建目录,因为已存在同名文件: {_tempDirectory}");
}
if (!Directory.Exists(_tempDirectory))
{
Directory.CreateDirectory(_tempDirectory);
}
}
catch (Exception ex)
{
throw new Exception("初始化临时目录 (InitializeTempDirectory)", ex);
}
}
/// <summary>