Skip to content

Commit 2935597

Browse files
Refactor output path calculation for Java files
1 parent 28b6136 commit 2935597

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎JavaToCSharpGui/ViewModels/MainWindowViewModel.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,13 @@ await Task.Run(async () =>
184184
outDir.Create();
185185

186186
string outDirFullName = outDir.FullName;
187-
int subStartIndex = dir.FullName.Length - 1;
188187

189188
foreach (var jFile in FolderInputFiles.Where(static x => x.Directory is not null))
190189
{
191190
// ! null checked above
192191
string jPath = jFile.Directory!.FullName;
193-
string jOutPath = $"{outDirFullName}{jPath[subStartIndex..]}";
192+
string relativePath = Path.GetRelativePath(dir.FullName, jPath);
193+
string jOutPath = Path.Combine(outDirFullName, relativePath);
194194
string jOutFileName = Path.GetFileNameWithoutExtension(jFile.Name) + ".cs";
195195
string jOutFileFullName = Path.Combine(jOutPath, jOutFileName);
196196

0 commit comments

Comments
 (0)