Skip to content

Commit

Permalink
refactor: pull default folder into a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-is-cute committed Aug 16, 2024
1 parent b66c9da commit cc6c8ee
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions DownloadTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ internal class DownloadTask : IDisposable {
private Util.SentryTransaction? Transaction { get; set; }

private const double Window = 5;
private const string DefaultFolder = "_default";

internal double BytesPerSecond {
get {
Expand Down Expand Up @@ -690,8 +691,8 @@ private static string[] GetOutputPaths(IReadOnlyCollection<List<string?>> files)
return MakePathPartsSafe(outputPath);
}
var group = MakeFileNameSafe(file[0] ?? "_default");
var option = MakeFileNameSafe(file[1] ?? "_default");
var group = MakeFileNameSafe(file[0] ?? DefaultFolder);
var option = MakeFileNameSafe(file[1] ?? DefaultFolder);
var gamePath = MakePathPartsSafe(file[2]!);
return Path.Join(group, option, gamePath);
Expand Down Expand Up @@ -1002,8 +1003,8 @@ private async Task ConstructDefaultMod(IDownloadTask_GetVersion info) {

var replacedPath = outputPath == null
? Path.Join(
"_default",
"_default",
DefaultFolder,
DefaultFolder,
MakePathPartsSafe(gamePath)
)
: MakePathPartsSafe(outputPath);
Expand Down Expand Up @@ -1115,8 +1116,8 @@ private async Task ConstructGroups(IDownloadTask_GetVersion info) {
var pathsMap = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
foreach (var (_, files) in info.NeededFiles.Files.Files) {
foreach (var file in files) {
var group = file[0] ?? "_default";
var option = file[1] ?? "_default";
var group = file[0] ?? DefaultFolder;
var option = file[1] ?? DefaultFolder;
var gamePath = file[2]!;
var outputPath = file[3];

Expand Down

0 comments on commit cc6c8ee

Please sign in to comment.