You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
461 B

  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package util
  5. import "path/filepath"
  6. // EnsureAbsolutePath ensure that a path is absolute, making it
  7. // relative to absoluteBase if necessary
  8. func EnsureAbsolutePath(path string, absoluteBase string) string {
  9. if filepath.IsAbs(path) {
  10. return path
  11. }
  12. return filepath.Join(absoluteBase, path)
  13. }