Only try loading .json files on startup (exclude .failed for example)
This commit is contained in:
parent
9db3f1b0da
commit
a75549c699
@ -150,10 +150,9 @@ public class JobBoss : GlobalBase
|
||||
File.SetUnixFileMode(TrangaSettings.jobsFolderPath, UserRead | UserWrite | UserExecute | GroupRead | OtherRead);
|
||||
if (!Directory.Exists(TrangaSettings.jobsFolderPath)) //No jobs to load
|
||||
return;
|
||||
Regex idRex = new (@"(.*)\.json");
|
||||
|
||||
//Load json-job-files
|
||||
foreach (FileInfo file in new DirectoryInfo(TrangaSettings.jobsFolderPath).EnumerateFiles().Where(fileInfo => idRex.IsMatch(fileInfo.Name)))
|
||||
foreach (FileInfo file in Directory.GetFiles(TrangaSettings.jobsFolderPath, "*.json").Select(f => new FileInfo(f)))
|
||||
{
|
||||
Log($"Adding {file.Name}");
|
||||
Job? job = JsonConvert.DeserializeObject<Job>(File.ReadAllText(file.FullName),
|
||||
|
Loading…
Reference in New Issue
Block a user