This commit is contained in:
Serge
2024-05-15 23:19:20 +02:00
parent 2628695bbc
commit 06b4df29cb

View File

@@ -30,15 +30,22 @@ public class Startup
var task = taskService.RootFolder.AllTasks.FirstOrDefault(t => t.Name == taskName);
if (task != null)
{
string strExeFilePath = Application.ExecutablePath.Trim();
string action = task.Definition.Actions.FirstOrDefault()!.ToString().Trim();
if (!strExeFilePath.Equals(action, StringComparison.OrdinalIgnoreCase) && !File.Exists(action))
try
{
Logger.WriteLine("File doesn't exist: " + action);
Logger.WriteLine("Rescheduling to: " + strExeFilePath);
UnSchedule();
Schedule();
string strExeFilePath = Application.ExecutablePath.Trim();
string action = task.Definition.Actions.FirstOrDefault()!.ToString().Trim();
if (!strExeFilePath.Equals(action, StringComparison.OrdinalIgnoreCase) && !File.Exists(action))
{
Logger.WriteLine("File doesn't exist: " + action);
Logger.WriteLine("Rescheduling to: " + strExeFilePath);
UnSchedule();
Schedule();
}
} catch (Exception ex)
{
Logger.WriteLine($"Can't check startup task: {ex.Message}");
}
}
}
}