Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/Core/ModManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public List<ModState> FetchState()
return new ModState(
PackageName: packageName,
PackagePath: packagePath,
IsEnabled: isEnabled,
IsEnabled: isEnabled,
IsInstalled: installedPackageNames.Contains(packageName)
);
});
Expand Down Expand Up @@ -290,7 +290,14 @@ private IReadOnlyCollection<string> ListModPackages(string path)
{
if (Directory.Exists(path))
{
return Directory.EnumerateFiles(path).ToList();
var options = new EnumerationOptions()
{
MatchType = MatchType.Win32,
IgnoreInaccessible = false,
AttributesToSkip = FileAttributes.Hidden | FileAttributes.System,
MaxRecursionDepth = 0,
};
return Directory.EnumerateFiles(path, "*", options).ToList();
}
else
{
Expand All @@ -300,7 +307,8 @@ private IReadOnlyCollection<string> ListModPackages(string path)

private string PackageName(string archivePath) => Path.GetFileNameWithoutExtension(archivePath);

private Dictionary<string, IReadOnlyCollection<string>> ReadPreviouslyInstalledFiles() {
private Dictionary<string, IReadOnlyCollection<string>> ReadPreviouslyInstalledFiles()
{
if (!File.Exists(workPaths.CurrentStateFile))
{
return new Dictionary<string, IReadOnlyCollection<string>>();
Expand All @@ -312,7 +320,8 @@ private Dictionary<string, IReadOnlyCollection<string>> ReadPreviouslyInstalledF

private void WriteInstalledFiles(Dictionary<string, IReadOnlyCollection<string>> filesByMod)
{
if (!filesByMod.Any() && !File.Exists(workPaths.CurrentStateFile)) {
if (!filesByMod.Any() && !File.Exists(workPaths.CurrentStateFile))
{
return;
}
File.WriteAllText(workPaths.CurrentStateFile, JsonConvert.SerializeObject(filesByMod, JsonSerializerSettings));
Expand Down