配置读取问题

This commit is contained in:
2024-12-31 17:51:47 +08:00
parent 4bbd9edc52
commit 5a9de4d1fc
5 changed files with 17 additions and 399 deletions
+15 -8
View File
@@ -113,19 +113,26 @@ namespace AibisDream.Utility
/// <returns>已改为json的文件名</returns>
public static string FormatAsJsonPath(string fileName)
{
// 找到最后一个点的位置
int lastDotIndex = fileName.LastIndexOf('.');
// // 找到最后一个点的位置
// int lastDotIndex = fileName.LastIndexOf('.');
//
// // 如果没有点,说明没有扩展名
// if (lastDotIndex == -1)
// {
// return fileName + JsonSuffix;
// }
//
// // 提取文件名(不包括扩展名)
// string fileNameWithoutExtension = fileName.Substring(0, lastDotIndex);
// // 返回新的文件名,使用 .json 作为扩展名
// return fileNameWithoutExtension + JsonSuffix;
// 如果没有点,说明没有扩展名
if (lastDotIndex == -1)
if (!fileName.EndsWith(JsonSuffix))
{
return fileName + JsonSuffix;
}
// 提取文件名(不包括扩展名)
string fileNameWithoutExtension = fileName.Substring(0, lastDotIndex);
// 返回新的文件名,使用 .json 作为扩展名
return fileNameWithoutExtension + JsonSuffix;
return fileName;
}
}