Adds settings methods to make paths absolute
This commit is contained in:
parent
4cc5b785a3
commit
3a5fc0e9e7
@ -72,8 +72,8 @@ func FindFileDir(file string) (string, error) {
|
||||
}
|
||||
|
||||
// AbsolutePath returns an the path if it is absolute or
|
||||
// otherwise filepath.Join(lib, path)
|
||||
func AbsolutePath(path, lib string) string {
|
||||
// otherwise filepath.Join(root, path)
|
||||
func AbsolutePath(path, root string) string {
|
||||
if filepath.IsAbs(path) {
|
||||
return path
|
||||
}
|
||||
|
@ -42,3 +42,15 @@ func FromFile(path string) (*Settings, error) {
|
||||
}
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
// AbsolutePaths makes all paths in settings absolute using the given
|
||||
// absolute root
|
||||
func (s *settings.Settings) AbsolutePaths(root string) {
|
||||
for i := range s.IgnoreDirs {
|
||||
s.IgnoreDirs[i] := helpers.AbsolutePath(s.IgnoreDirs[i], root)
|
||||
}
|
||||
for i := range s.LilypondIncludes {
|
||||
s.LilypondIncludes[i] := helpers.AbsolutePath(s.LilypondIncludes[i], root)
|
||||
}
|
||||
s.OutputDir := helpers.AbsolutePath(s.OutputDir, root)
|
||||
}
|
||||
|
Reference in New Issue
Block a user