mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-24 06:15:48 +02:00
Update plugin config to use the data folder instead of plugin root
This commit is contained in:
parent
bf224408a3
commit
c7e7403781
@ -27,13 +27,13 @@ public bool CanRun{
|
||||
|
||||
public bool HasConfig{
|
||||
get{
|
||||
return ConfigFile.Length > 0 && GetFullPathIfSafe(PluginFolder.Root, ConfigFile).Length > 0;
|
||||
return ConfigFile.Length > 0 && GetFullPathIfSafe(PluginFolder.Data, ConfigFile).Length > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public string ConfigPath{
|
||||
get{
|
||||
return HasConfig ? Path.Combine(GetPluginFolder(PluginFolder.Root), ConfigFile) : string.Empty;
|
||||
return HasConfig ? Path.Combine(GetPluginFolder(PluginFolder.Data), ConfigFile) : string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,6 +82,7 @@ private void OnMetadataLoaded(){
|
||||
|
||||
if (configPath.Length > 0 && defaultConfigPath.Length > 0 && !File.Exists(configPath) && File.Exists(defaultConfigPath)){
|
||||
try{
|
||||
Directory.CreateDirectory(GetPluginFolder(PluginFolder.Data));
|
||||
File.Copy(defaultConfigPath, configPath, false);
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Plugin Loading Error", "Could not generate a configuration file for '"+identifier+"' plugin.", true, e);
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
$TDP.checkFileExists(token, fileNameUser).then(exists => {
|
||||
var fileName = exists ? fileNameUser : fileNameDefault;
|
||||
|
||||
$TDP.readFile(token, fileName, true).then(contents => {
|
||||
|
||||
(exists ? $TDP.readFile(token, fileName, true) : $TDP.readFileRoot(token, fileName)).then(contents => {
|
||||
var obj;
|
||||
|
||||
try{
|
||||
|
Loading…
Reference in New Issue
Block a user