Skip to content

Commit

Permalink
[fix] fix for new file naming convention
Browse files Browse the repository at this point in the history
Also drops legacy support.

fixes #42
  • Loading branch information
alterNERDtive committed May 3, 2024
1 parent a865d1b commit 35120ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# 4.2.2 (2022-05-31)
# 5.0.0 (2024-05-03)

## Removed

* Will no longer copy Odyssey (live) binds to Horizons (legacy) binds. I doubt
anyone still plays the latter; if you do, don’t upgrade the pulgin.

## Fixed

* Will now find binds files again for the latest Elite update which changed
the format to `<name>.4.1.binds`.

# 4.2.2 (2022-05-31)

## Fixed

Expand Down
13 changes: 2 additions & 11 deletions bindED.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ private static string DetectBindsFile(string preset)
{
DirectoryInfo dirInfo = new (BindingsDir);
FileInfo[] bindFiles = dirInfo.GetFiles()
.Where(i => Regex.Match(i.Name, $@"^{Regex.Escape(preset)}\.[34]\.0\.binds$").Success)
.Where(i => Regex.Match(i.Name, $@"^{Regex.Escape(preset)}\.4\.\d\.binds$").Success)
.OrderByDescending(p => p.Name).ToArray();

if (bindFiles.Count() == 0)
Expand Down Expand Up @@ -503,20 +503,11 @@ private static void FileChangedHandler(string name)
Preset = null;
LoadBinds(Binds);
}
else if (Regex.Match(name, $@"{Preset}(\.[34]\.0)?\.binds$").Success)
else if (Regex.Match(name, $@"^{Regex.Escape(preset)}\.4\.\d\.binds$").Success)
{
LogInfo($"Bindings file '{name}' has changed, reloading …");
Binds = null;
LoadBinds(Binds);

// copy Odyssey -> Horizons
if (name == $"{Preset}.4.0.binds" && !VA!.GetBoolean("bindED.disableHorizonsSync#"))
{
File.WriteAllText(
Path.Combine(BindingsDir, $"{Preset}.3.0.binds"),
File.ReadAllText(Path.Combine(BindingsDir, name))
.Replace("MajorVersion=\"4\" MinorVersion=\"0\">", "MajorVersion=\"3\" MinorVersion=\"0\">"));
}
}
}
catch (Exception e)
Expand Down

0 comments on commit 35120ad

Please sign in to comment.