Browse Source

修复 CopyConfigValuesToTempAsync 拷贝文件 传tmp目录

feature/protocol-log-Perfect
root 2 weeks ago
parent
commit
0c93da1fbc
  1. 10
      CoreAgent.Infrastructure/Services/Network/NetworkConfigCopier.cs

10
CoreAgent.Infrastructure/Services/Network/NetworkConfigCopier.cs

@ -39,7 +39,7 @@ public class NetworkConfigCopier : INetworkConfigCopier
// 复制 RAG 配置文件 // 复制 RAG 配置文件
if (!string.IsNullOrEmpty(networkConfig.RagConfig)) if (!string.IsNullOrEmpty(networkConfig.RagConfig))
{ {
if (!CopyConfigFile(networkConfig.RagConfig, appSettings.RanConfigDirectory, if (!CopyConfigFile(networkConfig.RagConfig, appSettings.TempDirectory,appSettings.RanConfigDirectory,
path => networkConfig.RagConfig = path, "RAG")) path => networkConfig.RagConfig = path, "RAG"))
{ {
return NetworkConfigCopyResult.Failure("复制RAG配置文件失败"); return NetworkConfigCopyResult.Failure("复制RAG配置文件失败");
@ -51,7 +51,7 @@ public class NetworkConfigCopier : INetworkConfigCopier
{ {
if (!string.IsNullOrEmpty(config.CoreNetworkConfig)) if (!string.IsNullOrEmpty(config.CoreNetworkConfig))
{ {
if (!CopyConfigFile(config.CoreNetworkConfig, appSettings.MmeConfigDirectory, if (!CopyConfigFile(config.CoreNetworkConfig,appSettings.TempDirectory, appSettings.MmeConfigDirectory,
path => config.CoreNetworkConfig = path, "核心网络")) path => config.CoreNetworkConfig = path, "核心网络"))
{ {
return NetworkConfigCopyResult.Failure("复制CN配置文件失败"); return NetworkConfigCopyResult.Failure("复制CN配置文件失败");
@ -60,7 +60,7 @@ public class NetworkConfigCopier : INetworkConfigCopier
if (!string.IsNullOrEmpty(config.ImsConfig)) if (!string.IsNullOrEmpty(config.ImsConfig))
{ {
if (!CopyConfigFile(config.ImsConfig, appSettings.MmeConfigDirectory, if (!CopyConfigFile(config.ImsConfig, appSettings.TempDirectory, appSettings.MmeConfigDirectory,
path => config.ImsConfig = path, "IMS")) path => config.ImsConfig = path, "IMS"))
{ {
return NetworkConfigCopyResult.Failure("复制IMS配置文件失败"); return NetworkConfigCopyResult.Failure("复制IMS配置文件失败");
@ -170,7 +170,7 @@ public class NetworkConfigCopier : INetworkConfigCopier
} }
} }
private bool CopyConfigFile(string sourcePath, string targetDirectory, Action<string> updatePath, string configType) private bool CopyConfigFile(string sourcePath,string tempDirectory, string targetDirectory, Action<string> updatePath, string configType)
{ {
if (!File.Exists(sourcePath)) if (!File.Exists(sourcePath))
{ {
@ -179,7 +179,7 @@ public class NetworkConfigCopier : INetworkConfigCopier
} }
var fileName = Path.GetFileName(sourcePath); var fileName = Path.GetFileName(sourcePath);
var tempPath = Path.Combine(targetDirectory, fileName); var tempPath = Path.Combine(tempDirectory, fileName);
// 始终复制到临时目录 // 始终复制到临时目录
File.Copy(sourcePath, tempPath, true); File.Copy(sourcePath, tempPath, true);

Loading…
Cancel
Save