mirror of
https://github.com/tonytins/StaggerPost.git
synced 2025-03-23 05:40:16 +00:00
Fixed an oversight
- Now properly checks for the config in the base application directory - Topics in sample config was changed - FileDir was renamed to outputDir - scheduleFile was renamed to outputFile - communities was renamed to defaultTopics
This commit is contained in:
parent
7c61c51ac2
commit
5cccb9a4b2
3 changed files with 17 additions and 11 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
// I hereby waive this project under the public domain - see UNLICENSE for details.
|
||||||
namespace PublishTimes;
|
namespace PublishTimes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
20
Program.cs
20
Program.cs
|
@ -127,15 +127,15 @@ string NewTopic(List<string> topics)
|
||||||
void ExportSchedule(List<String> storeSchedule)
|
void ExportSchedule(List<String> storeSchedule)
|
||||||
{
|
{
|
||||||
// App directory is used for config file
|
// App directory is used for config file
|
||||||
var appDir = Directory.GetCurrentDirectory();
|
var appDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
// File directory is used for file location set in config
|
// File directory is used for file location set in config
|
||||||
var fileDir = Directory.GetCurrentDirectory();
|
var outputDir = Directory.GetCurrentDirectory();
|
||||||
var communities = new[] { "Games", "Politics", "Research", "Technology" };
|
var defaultTopics = new[] { "Games", "Politics", "Research", "Technology" };
|
||||||
var scheduleFile = "schedule.txt";
|
var outputFile = "schedule.txt";
|
||||||
var cfgFile = "config.toml";
|
var cfgFile = "config.toml";
|
||||||
|
|
||||||
var cfgPath = Path.Combine(appDir, cfgFile);
|
var cfgPath = Path.Combine(appDir, cfgFile);
|
||||||
var filePath = Path.Combine(fileDir, scheduleFile);
|
var filePath = Path.Combine(outputDir, outputFile);
|
||||||
var appendSchedule = false;
|
var appendSchedule = false;
|
||||||
var topic = "";
|
var topic = "";
|
||||||
|
|
||||||
|
@ -150,19 +150,19 @@ void ExportSchedule(List<String> storeSchedule)
|
||||||
var usrList = tomlList.Split(',');
|
var usrList = tomlList.Split(',');
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(usrDir))
|
if (!string.IsNullOrEmpty(usrDir))
|
||||||
fileDir = usrDir;
|
outputDir = usrDir;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(usrFileName))
|
if (!string.IsNullOrEmpty(usrFileName))
|
||||||
scheduleFile = usrFileName;
|
outputFile = usrFileName;
|
||||||
|
|
||||||
if (usrList.Length > 0)
|
if (usrList.Length > 0)
|
||||||
communities = usrList;
|
defaultTopics = usrList;
|
||||||
|
|
||||||
// Set new file Path
|
// Set new file Path
|
||||||
filePath = Path.Combine(fileDir, scheduleFile);
|
filePath = Path.Combine(outputDir, outputFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
topic = NewTopic(communities.ToList());
|
topic = NewTopic(defaultTopics.ToList());
|
||||||
|
|
||||||
// If the file already exists, assume a previous schedule was written
|
// If the file already exists, assume a previous schedule was written
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
path = "/home/tonytins/Documents/"
|
path = "/home/tonytins/Documents/"
|
||||||
file = "newscycle.txt"
|
file = "newscycle.txt"
|
||||||
topics = [ "Games", "Technology", "Cybersecurity" ]
|
topics = [
|
||||||
|
"Games",
|
||||||
|
"News",
|
||||||
|
"Science",
|
||||||
|
"Programming"
|
||||||
|
]
|
||||||
|
|
Loading…
Add table
Reference in a new issue