mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-07-17 19:40:45 +00:00
fix: redirect AppContext.BaseDirectory to server root for FourKit plugins
AppContext.BaseDirectory pointed to the runtime/ subfolder where the self-contained .NET payload lives, causing plugins that use it for file paths to write to the wrong directory. Now set to the server exe directory at startup via AppContext.SetData. Also adds serverDirectory and dataDirectory properties to ServerPlugin so plugin authors have convenient access to the server root and a per-plugin data folder (plugins/<PluginName>/) without needing to resolve paths manually.
This commit is contained in:
@@ -28,6 +28,22 @@ public abstract class ServerPlugin
|
||||
/// </summary>
|
||||
public virtual string author { get; } = "Unknown";
|
||||
|
||||
/// <summary>
|
||||
/// The server's root directory (where the server executable lives).
|
||||
/// Use this instead of <c>AppContext.BaseDirectory</c> which points
|
||||
/// to the .NET runtime subfolder. Set automatically before
|
||||
/// <see cref="onEnable"/> is called.
|
||||
/// </summary>
|
||||
public string serverDirectory { get; internal set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// A per-plugin data directory (<c>plugins/<PluginName>/</c>).
|
||||
/// Created automatically if it does not exist. Use this for config
|
||||
/// files, logs, databases, or any plugin-specific storage.
|
||||
/// Set automatically before <see cref="onEnable"/> is called.
|
||||
/// </summary>
|
||||
public string dataDirectory { get; internal set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Called when this plugin is enabled
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user