From d070bdf10f14d233288f7318a4e9f7555f070a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 21 Mar 2022 09:35:15 +0100 Subject: Rework the Destination filesystem to make --renderStaticToDisk work See #9626 --- common/paths/path.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'common/paths/path.go') diff --git a/common/paths/path.go b/common/paths/path.go index 63e831ff6..3a7f3e790 100644 --- a/common/paths/path.go +++ b/common/paths/path.go @@ -63,6 +63,15 @@ func (filepathBridge) Separator() string { var fpb filepathBridge +// AbsPathify creates an absolute path if given a working dir and a relative path. +// If already absolute, the path is just cleaned. +func AbsPathify(workingDir, inPath string) string { + if filepath.IsAbs(inPath) { + return filepath.Clean(inPath) + } + return filepath.Join(workingDir, inPath) +} + // MakeTitle converts the path given to a suitable title, trimming whitespace // and replacing hyphens with whitespace. func MakeTitle(inpath string) string { -- cgit v1.2.3