Skip to content

Commit

Permalink
Revert .yaml file extension changes.
Browse files Browse the repository at this point in the history
This reverts commit d8d2993.
This reverts commit a7d79ee.
This reverts commit 58c79b2.

See space-wizards/space-station-14#13971
  • Loading branch information
PJB3005 committed Feb 7, 2023
1 parent f143ee6 commit 1f1f58a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ indent_size = 4
trim_trailing_whitespace = true
charset = utf-8

[*.{csproj,xml,yml,yaml,dll.config,targets,props}]
[*.{csproj,xml,yml,dll.config,targets,props}]
indent_size = 2

[*.gdsl]
Expand Down
3 changes: 2 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ END TEMPLATE-->

### Breaking changes

*None yet*
* Undid `*.yaml` prototype loading change from previous version.

### New features

Expand Down Expand Up @@ -78,6 +78,7 @@ END TEMPLATE-->
* UI content scale is now listed in the F3 coordinates panel.
* SDL2 backend is now wired up to update key names dynamically on keyboard mode change.
* The prototype reload event is no longer wrapped under #if !FULL_RELEASE.
* The engine now loads `*.yaml` files (previously loading only `*.yml`) for prototypes.

### Internal

Expand Down
23 changes: 6 additions & 17 deletions Robust.Client/Prototypes/ClientPrototypeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Robust.Client.Timing;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.ContentPack;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Network;
Expand Down Expand Up @@ -86,20 +87,13 @@ private void WatchResources()
foreach (var path in Resources.GetContentRoots().Select(r => r.ToString())
.Where(r => Directory.Exists(r + "/Prototypes")).Select(p => p + "/Prototypes"))
{
var watcherYml = new FileSystemWatcher(path, "*.yml")
var watcher = new FileSystemWatcher(path, "*.yml")
{
IncludeSubdirectories = true,
NotifyFilter = NotifyFilters.LastWrite
};

//filesystemwatcher doesnt support multiple filters, so we gotta do this. its a debug feature, so i dont think its that critical
var watcherYaml = new FileSystemWatcher(path, "*.yaml")
{
IncludeSubdirectories = true,
NotifyFilter = NotifyFilters.LastWrite
};

void OnWatcherOnChanged(object _, FileSystemEventArgs args)
watcher.Changed += (_, args) =>
{
switch (args.ChangeType)
{
Expand Down Expand Up @@ -129,17 +123,12 @@ void OnWatcherOnChanged(object _, FileSystemEventArgs args)
_reloadQueue.Add(relative);
}
});
}

watcherYml.Changed += OnWatcherOnChanged;
watcherYaml.Changed += OnWatcherOnChanged;
};

try
{
watcherYml.EnableRaisingEvents = true;
watcherYaml.EnableRaisingEvents = true;
_watchers.Add(watcherYml);
_watchers.Add(watcherYaml);
watcher.EnableRaisingEvents = true;
_watchers.Add(watcher);
}
catch (IOException ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public sealed class AssetPassNormalizeText : AssetPass
"txt",
"json",
"yml",
"yaml",
"html",
"css",
"js",
Expand Down
4 changes: 2 additions & 2 deletions Robust.Shared/Prototypes/PrototypeManager.YamlLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void LoadDirectory(ResourcePath path, bool overwrite = false,
{
_hasEverBeenReloaded = true;
var streams = Resources.ContentFindFiles(path)
.Where(ResourcePath.IsYamlResourceFile)
.Where(filePath => filePath.Extension == "yml" && !filePath.Filename.StartsWith("."))
.ToArray();

// Shuffle to avoid input data patterns causing uneven thread workloads.
Expand Down Expand Up @@ -84,7 +84,7 @@ public void LoadDirectory(ResourcePath path, bool overwrite = false,
public Dictionary<string, HashSet<ErrorNode>> ValidateDirectory(ResourcePath path)
{
var streams = Resources.ContentFindFiles(path).ToList().AsParallel()
.Where(ResourcePath.IsYamlResourceFile);
.Where(filePath => filePath.Extension == "yml" && !filePath.Filename.StartsWith("."));

var dict = new Dictionary<string, HashSet<ErrorNode>>();
foreach (var resourcePath in streams)
Expand Down
6 changes: 0 additions & 6 deletions Robust.Shared/Utility/ResourcePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -717,11 +717,5 @@ private static void ValidateSeparate(string separator)
throw new ArgumentException("Separator may not be . or ..");
}
}

public static bool IsYamlResourceFile(ResourcePath filePath)
{
return filePath.Extension is "yml" or "yaml" &&
!filePath.Filename.StartsWith(".", StringComparison.Ordinal);
}
}
}

0 comments on commit 1f1f58a

Please sign in to comment.