77 "fmt"
88 "io"
99 "os"
10- "path/filepath"
1110 "runtime"
1211 "runtime/debug"
1312 "sort"
@@ -282,14 +281,6 @@ func showProfile(output io.Writer, c *config.Config, flags commandLineFlags, arg
282281 // Display deprecation notice
283282 displayProfileDeprecationNotices (profile )
284283
285- // All files in the configuration are relative to the configuration file, NOT the folder where resticprofile is started
286- // So we need to fix all relative files
287- rootPath := filepath .Dir (c .GetConfigFile ())
288- if rootPath != "." {
289- clog .Debugf ("files in configuration are relative to '%s'" , rootPath )
290- }
291- profile .SetRootPath (rootPath )
292-
293284 config .ShowStruct (os .Stdout , profile , flags .name )
294285 fmt .Println ("" )
295286 return nil
@@ -357,8 +348,9 @@ func flagsForProfile(flags commandLineFlags, profileName string) commandLineFlag
357348// createSchedule accepts one argument from the commandline: --no-start
358349func createSchedule (_ io.Writer , c * config.Config , flags commandLineFlags , args []string ) error {
359350 type profileJobs struct {
360- scheduler , profile string
361- jobs []* config.ScheduleConfig
351+ scheduler schedule.SchedulerType
352+ profile string
353+ jobs []* config.ScheduleConfig
362354 }
363355
364356 allJobs := make ([]profileJobs , 0 , 1 )
@@ -456,7 +448,7 @@ func statusSchedule(w io.Writer, c *config.Config, flags commandLineFlags, args
456448 return nil
457449}
458450
459- func statusScheduleProfile (scheduler string , profile * config.Profile , schedules []* config.ScheduleConfig , flags commandLineFlags ) error {
451+ func statusScheduleProfile (scheduler schedule. SchedulerType , profile * config.Profile , schedules []* config.ScheduleConfig , flags commandLineFlags ) error {
460452 displayProfileDeprecationNotices (profile )
461453
462454 err := statusJobs (scheduler , flags .name , convertSchedules (schedules ))
@@ -466,21 +458,21 @@ func statusScheduleProfile(scheduler string, profile *config.Profile, schedules
466458 return nil
467459}
468460
469- func getScheduleJobs (c * config.Config , flags commandLineFlags ) (string , * config.Profile , []* config.ScheduleConfig , error ) {
461+ func getScheduleJobs (c * config.Config , flags commandLineFlags ) (schedule. SchedulerType , * config.Profile , []* config.ScheduleConfig , error ) {
470462 global , err := c .GetGlobalSection ()
471463 if err != nil {
472- return "" , nil , nil , fmt .Errorf ("cannot load global section: %w" , err )
464+ return nil , nil , nil , fmt .Errorf ("cannot load global section: %w" , err )
473465 }
474466
475467 profile , err := c .GetProfile (flags .name )
476468 if err != nil {
477- return "" , nil , nil , fmt .Errorf ("cannot load profile '%s': %w" , flags .name , err )
469+ return nil , nil , nil , fmt .Errorf ("cannot load profile '%s': %w" , flags .name , err )
478470 }
479471 if profile == nil {
480- return "" , nil , nil , fmt .Errorf ("profile '%s' not found" , flags .name )
472+ return nil , nil , nil , fmt .Errorf ("profile '%s' not found" , flags .name )
481473 }
482474
483- return global . Scheduler , profile , profile .Schedules (), nil
475+ return schedule . NewSchedulerType ( global ) , profile , profile .Schedules (), nil
484476}
485477
486478func requireScheduleJobs (schedules []* config.ScheduleConfig , flags commandLineFlags ) error {
@@ -490,10 +482,10 @@ func requireScheduleJobs(schedules []*config.ScheduleConfig, flags commandLineFl
490482 return nil
491483}
492484
493- func getRemovableScheduleJobs (c * config.Config , flags commandLineFlags ) (string , * config.Profile , []schedule.Config , error ) {
485+ func getRemovableScheduleJobs (c * config.Config , flags commandLineFlags ) (schedule. SchedulerType , * config.Profile , []schedule.Config , error ) {
494486 scheduler , profile , schedules , err := getScheduleJobs (c , flags )
495487 if err != nil {
496- return "" , nil , nil , err
488+ return nil , nil , nil , err
497489 }
498490
499491 configs := convertSchedules (schedules )
0 commit comments