Skip to content

Fix output path detection to correctly identify directories and files - #1556

Merged
Tyrrrz merged 1 commit into
Tyrrrz:primefrom
CanePlayz:fix-1502-output-path-detection
Jun 20, 2026
Merged

Tyrrrz merged 1 commit into
Tyrrrz:primefrom
CanePlayz:fix-1502-output-path-detection

Conversation

@CanePlayz

Copy link
Copy Markdown
Contributor

Related to issue #1502

var actualOutputPath = FormatPath(outputPath, guild, channel, after, before);
// Output is a directory
if (
Directory.Exists(actualOutputPath)
|| string.IsNullOrWhiteSpace(Path.GetExtension(actualOutputPath))
)
{
var fileName = GetDefaultOutputFileName(guild, channel, format, after, before);
return Path.Combine(actualOutputPath, fileName);
}
// Output is a file
return actualOutputPath;

Issue: You use %G at the end of a path with the guild name containing a period. The heuristic from the code snippet above identifies the resolved server name as a file path as Path.GetExtension(actualOutputPath) does not return Null. DCE then tries to export all channels into this one file, e.g., Discord.Test, leading to a System.IO.IOException due to concurrent access to one file by multiple processes if the export is parallelized.

Solution: Evaluate the extension-based heuristic on the original, unsubstituted outputPath instead of the resolved path. The template path has no unwanted extension and therefore the user intent of creating a directory is preserved.

@Tyrrrz Tyrrrz added the bug label Jun 20, 2026
@Tyrrrz
Tyrrrz merged commit 97485c2 into Tyrrrz:prime Jun 20, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants