Skip to content
This repository was archived by the owner on Mar 15, 2024. It is now read-only.

Commit 6e7e62a

Browse files
committed
Fix(core): path resolver
1 parent e9a748b commit 6e7e62a

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

.github/workflows/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ jobs:
3838

3939
- name: Build
4040
shell: bash
41-
#dotnet build Core/core.csproj -f net7.0 -r win-x86 -c Debug --no-self-contained --output .deploy
4241
run: |
4342
COMMIT_VERSION=$(git rev-list --count HEAD)
4443
dotnet build PluginExample/PluginExample.csproj -f net7.0 -r ${{ matrix.target }} --no-self-contained -c Release

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ FodyWeavers.xsd
398398
*.sln.iml
399399
.idea
400400

401-
# Counter
401+
# VS Code
402+
.vscode
402403
.VSCodeCounter
403404

404405
# Build

Core/Bootstrap.cs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,14 @@ private static int Initialize()
3030
{
3131
try
3232
{
33-
Console.WriteLine("SourceSharp Path: " + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
34-
Console.WriteLine("GetGamePath: " + Bridges.SourceSharp.GetGamePath());
33+
var root = Path.Combine(Path.GetDirectoryName(
34+
Assembly.GetExecutingAssembly().Location)!,
35+
Bridges.SourceSharp.GetGamePath(),
36+
"addons",
37+
"sourcesharp");
3538

36-
// bin
37-
var dir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)!;
38-
// root
39-
var parent = Directory.GetParent(dir)!.Name;
4039
// config
41-
var path = Path.Combine(parent, "configs", "core.json");
42-
43-
#if DEBUG
44-
if (!File.Exists(path))
45-
{
46-
path = Path.Combine(dir, "config.json");
47-
}
48-
#endif
40+
var path = Path.Combine(root, "configs", "core.json");
4941

5042
var services = new ServiceCollection();
5143
var configuration = new ConfigurationBuilder().AddJsonFile(path).Build();

Core/Core.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
3838
</PropertyGroup>
3939
<ItemGroup>
40-
<None Remove="config.json" />
40+
<None Remove="core.json" />
4141
</ItemGroup>
4242
<ItemGroup>
43-
<EmbeddedResource Include="config.json">
43+
<EmbeddedResource Include="core.json">
4444
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
4545
</EmbeddedResource>
4646
</ItemGroup>

Core/PluginManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ public void Initialize()
3636
{
3737
_listeners.AddRange(_services.GetServices<IListenerBase>());
3838

39-
foreach (var path in Directory.GetDirectories(Path.Combine("plugins"), "*", SearchOption.TopDirectoryOnly))
39+
var sourceSharpRoot = Path.Combine(_sourceSharp.GetRootPath(), _sourceSharp.GetGamePath(), "addons", "sourcesharp");
40+
41+
foreach (var path in Directory.GetDirectories(Path.Combine(sourceSharpRoot, "plugins"), "*", SearchOption.TopDirectoryOnly))
4042
{
4143
CPlugin? plugin = null;
4244
var name = Path.GetFileName(path);
File renamed without changes.

0 commit comments

Comments
 (0)