summaryrefslogtreecommitdiffstats
path: root/modules/util/copy.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-12-25 09:59:32 +0000
committerGitHub <noreply@github.com>2020-12-25 11:59:32 +0200
commita19447aed128ecadfcd938d6a80cd4951af1f4ce (patch)
tree6312bf946d601aab29731645a4777feeaea66036 /modules/util/copy.go
parent04ae0f2f3f4556c6d0b4adc5f2cffd0cc7d25151 (diff)
downloadgitea-a19447aed128ecadfcd938d6a80cd4951af1f4ce.tar.gz
gitea-a19447aed128ecadfcd938d6a80cd4951af1f4ce.zip
migrate from com.* to alternatives (#14103)
* remove github.com/unknwon/com from models * dont use "com.ToStr()" * replace "com.ToStr" with "fmt.Sprint" where its easy to do * more refactor * fix test * just "proxy" Copy func for now * as per @lunny
Diffstat (limited to 'modules/util/copy.go')
-rw-r--r--modules/util/copy.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/util/copy.go b/modules/util/copy.go
new file mode 100644
index 0000000000..46765849dc
--- /dev/null
+++ b/modules/util/copy.go
@@ -0,0 +1,20 @@
+// Copyright 2020 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package util
+
+import (
+ "github.com/unknwon/com"
+)
+
+// CopyFile copies file from source to target path.
+func CopyFile(src, dest string) error {
+ return com.Copy(src, dest)
+}
+
+// CopyDir copy files recursively from source to target directory.
+// It returns error when error occurs in underlying functions.
+func CopyDir(srcPath, destPath string) error {
+ return com.CopyDir(srcPath, destPath)
+}