mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #239 from Caraxi/plugin-config-folder
Plugin Config Directories
This commit is contained in:
commit
3e4a9f985c
2 changed files with 20 additions and 0 deletions
|
|
@ -42,6 +42,18 @@ namespace Dalamud.Configuration
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetDirectory(string pluginName) {
|
||||||
|
try {
|
||||||
|
var path = GetDirectoryPath(pluginName);
|
||||||
|
if (!path.Exists) {
|
||||||
|
path.Create();
|
||||||
|
}
|
||||||
|
return path.FullName;
|
||||||
|
} catch {
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Parameterized deserialization
|
// Parameterized deserialization
|
||||||
// Currently this is called via reflection from DalamudPluginInterface.GetPluginConfig()
|
// Currently this is called via reflection from DalamudPluginInterface.GetPluginConfig()
|
||||||
// Eventually there may be an additional pluginInterface method that can call this directly
|
// Eventually there may be an additional pluginInterface method that can call this directly
|
||||||
|
|
@ -59,5 +71,7 @@ namespace Dalamud.Configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileInfo GetPath(string pluginName) => new FileInfo(Path.Combine(this.configDirectory.FullName, $"{pluginName}.json"));
|
private FileInfo GetPath(string pluginName) => new FileInfo(Path.Combine(this.configDirectory.FullName, $"{pluginName}.json"));
|
||||||
|
private DirectoryInfo GetDirectoryPath(string pluginName) => new DirectoryInfo(Path.Combine(this.configDirectory.FullName, pluginName));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,12 @@ namespace Dalamud.Plugin
|
||||||
return this.configs.Load(this.pluginName);
|
return this.configs.Load(this.pluginName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the config directory
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>directory with path of AppData/XIVLauncher/pluginConfig/PluginInternalName </returns>
|
||||||
|
public string GetPluginConfigDirectory() => this.configs.GetDirectory(this.pluginName);
|
||||||
|
|
||||||
#region Chat Links
|
#region Chat Links
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue