File tree 4 files changed +38
-5
lines changed
4 files changed +38
-5
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,28 @@ std::vector<APILayer> OrderingLintError::Fix(
104
104
return newLayers;
105
105
}
106
106
107
+ KnownBadLayerLintError::KnownBadLayerLintError (
108
+ const std::string& description,
109
+ const std::filesystem::path& layer)
110
+ : FixableLintError(description, {layer}) {
111
+ }
112
+
113
+ std::vector<APILayer> KnownBadLayerLintError::Fix (
114
+ const std::vector<APILayer>& allLayers) {
115
+ const auto affected = this ->GetAffectedLayers ();
116
+ assert (affected.size () == 1 );
117
+ const auto & path = *affected.begin ();
118
+
119
+ auto newLayers = allLayers;
120
+ auto it = std::ranges::find_if (
121
+ newLayers, [&path](const auto & layer) { return layer.mJSONPath == path; });
122
+
123
+ if (it != newLayers.end ()) {
124
+ it->mValue = APILayer::Value::Disabled;
125
+ }
126
+ return newLayers;
127
+ }
128
+
107
129
InvalidLayerLintError::InvalidLayerLintError (
108
130
const std::string& description,
109
131
const std::filesystem::path& layer)
Original file line number Diff line number Diff line change @@ -64,7 +64,18 @@ class OrderingLintError final : public FixableLintError {
64
64
std::filesystem::path mRelativeTo ;
65
65
};
66
66
67
- // A lint error that is fixed by removing the layer
67
+ // / A lint error that is fixed by disabling the layer
68
+ class KnownBadLayerLintError final : public FixableLintError {
69
+ public:
70
+ KnownBadLayerLintError (
71
+ const std::string& description,
72
+ const std::filesystem::path& layer);
73
+
74
+ ~KnownBadLayerLintError () override = default ;
75
+ std::vector<APILayer> Fix (const std::vector<APILayer>&) override ;
76
+ };
77
+
78
+ // / A lint error that is fixed by removing the layer
68
79
class InvalidLayerLintError final : public FixableLintError {
69
80
public:
70
81
InvalidLayerLintError (
Original file line number Diff line number Diff line change @@ -29,11 +29,11 @@ class OpenXRToolkitLinter final : public Linter {
29
29
if (details.mName != " XR_APILAYER_MBUCCHIA_toolkit" ) {
30
30
continue ;
31
31
}
32
- errors.push_back (std::make_shared<LintError >(
32
+ errors.push_back (std::make_shared<KnownBadLayerLintError >(
33
33
" OpenXR Toolkit is unsupported, and is known to cause crashes and "
34
34
" other issues in modern games; you should disable it if you encounter "
35
35
" problems." ,
36
- PathSet { layer.mJSONPath } ));
36
+ layer.mJSONPath ));
37
37
}
38
38
return errors;
39
39
}
Original file line number Diff line number Diff line change @@ -33,11 +33,11 @@ class XRNeckSaferLinter final : public Linter {
33
33
continue ;
34
34
}
35
35
errors.push_back (
36
- std::make_shared<LintError >(
36
+ std::make_shared<KnownBadLayerLintError >(
37
37
" XRNeckSafer has bugs that can cause issues include game crashes, and "
38
38
" crashes in other API layers. Disable or uninstall it if you have any "
39
39
" issues." ,
40
- PathSet { layer.mJSONPath } ));
40
+ layer.mJSONPath ));
41
41
}
42
42
return errors;
43
43
}
You can’t perform that action at this time.
0 commit comments