aboutsummaryrefslogtreecommitdiff
path: root/internal/osutil/osutil.go
diff options
context:
space:
mode:
authorMichael Li <alimy@gility.net>2020-02-17 22:48:24 +0800
committerGitHub <noreply@github.com>2020-02-17 22:48:24 +0800
commit4d83fd4238e177d9327c760a5386bc53f25dedbb (patch)
tree4c730773e80d0110a449392513b88d70cf1e85fe /internal/osutil/osutil.go
parentfd14ad6ce9bfe14e2a551845f27058ecf3853d74 (diff)
Use go-bindata to embed `public` and `templates` files into binary (#5920)
* fixed private repositories are hidden in the organization's view * use go-bindata integrate public and templates files to gogs binary * optimize Dockerfile don't COPY public and templates files * use kevinburke's go-bindata to generate assets code * reset develepment as default run mode in configure file * optimize generated assets code relayout and help function * fixed code format * Update conf/app.ini * assets: add LICENSE headers * Some housekeeping * assets/public: simplify code logic * assets/templates: simplify code logic * cmd/web: more concise variable names * Minor changes * Add custom public and templates support back Co-authored-by: ᴜɴᴋɴᴡᴏɴ <u@gogs.io>
Diffstat (limited to 'internal/osutil/osutil.go')
-rw-r--r--internal/osutil/osutil.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/osutil/osutil.go b/internal/osutil/osutil.go
new file mode 100644
index 00000000..6573cea0
--- /dev/null
+++ b/internal/osutil/osutil.go
@@ -0,0 +1,18 @@
+// Copyright 2020 The Gogs 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 osutil
+
+import (
+ "os"
+)
+
+// IsFile returns true if given path exists as a file (i.e. not a directory).
+func IsFile(path string) bool {
+ f, e := os.Stat(path)
+ if e != nil {
+ return false
+ }
+ return !f.IsDir()
+}