Skip to content

Commit

Permalink
fix: #301 Linux下输出文件有多余的反斜杠
Browse files Browse the repository at this point in the history
  • Loading branch information
nopdan committed Mar 13, 2024
1 parent 5eca41c commit 2a3847e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/ImeWlConverterCore/MainBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,9 @@ public void Convert(IList<string> filePathes, string outputDir)
ExportContents = export.Export(wlList);
for (var i = 0; i < ExportContents.Count; i++)
{
string exportPath = outputDir + (outputDir.EndsWith("\\") ? "" : "\\") +
Path.GetFileNameWithoutExtension(file) + (i == 0 ? "" : i.ToString()) +
".txt";
if (!Directory.Exists(outputDir)) Directory.CreateDirectory(outputDir);
string exportPath = Path.Combine(outputDir,
Path.GetFileNameWithoutExtension(file) + (i == 0 ? "" : i.ToString()) + ".txt");
FileOperationHelper.WriteFile(exportPath, export.Encoding, ExportContents[i]);
}
ExportContents = new List<string>();
Expand All @@ -779,8 +779,9 @@ public void ExportToFile(string filePath)
var outputDir = Path.GetDirectoryName(filePath);
for (var i = 0; i < ExportContents.Count; i++)
{
string exportPath = outputDir + (outputDir.EndsWith("\\") ? "" : "\\") +
Path.GetFileNameWithoutExtension(filePath) + (i == 0 ? "" : i.ToString()) + ".txt";
if (!Directory.Exists(outputDir)) Directory.CreateDirectory(outputDir);
string exportPath = Path.Combine(outputDir,
Path.GetFileNameWithoutExtension(filePath) + (i == 0 ? "" : i.ToString()) + ".txt");
FileOperationHelper.WriteFile(exportPath, export.Encoding, ExportContents[i]);
}
ExportContents = new List<string>();
Expand Down

0 comments on commit 2a3847e

Please sign in to comment.