member center, blog redesign
This commit is contained in:
app
conf
messages
public
blog
README.md
css
js
bootstrap-dialog.min.jsbootstrap-hover-dropdown.js
ck
common.jsjquery-cookie-min.jsjquery.qrcode.min.jsjsrender.jsshare_comment.jsthemes
README.md
default
404.htmlarchive.htmlcate.htmlfooter.htmlheader.htmlhighlight.html
images
index.htmlpage.htmlpaging.htmlpost.htmlsearch.htmlshare_comment.htmlsingle.htmlstyle.csstag_posts.htmltags.htmltheme.jsonelegant
404.htmlarchive.htmlcate.htmlfooter.htmlheader.htmlhighlight.html
images
index.htmlpaging.htmlpost.htmlsearch.htmlshare_comment.htmlsingle.htmlstyle.csstag_posts.htmltags.htmltheme.jsonnav_fixed
js
member
css
js
ace
ace.jsext-beautify.jsext-chromevox.jsext-elastic_tabstops_lite.jsext-emmet.jsext-error_marker.jsext-keybinding_menu.jsext-language_tools.jsext-linking.jsext-modelist.jsext-old_ie.jsext-prompt.jsext-searchbox.jsext-settings_menu.jsext-spellcheck.jsext-split.jsext-static_highlight.jsext-statusbar.jsext-textarea.jsext-themelist.jsext-whitespace.jskeybinding-emacs.jskeybinding-vim.jsmode-abap.jsmode-actionscript.jsmode-ada.jsmode-apache_conf.jsmode-applescript.jsmode-asciidoc.jsmode-assembly_x86.jsmode-autohotkey.jsmode-batchfile.jsmode-c9search.jsmode-c_cpp.jsmode-cirru.jsmode-clojure.jsmode-cobol.jsmode-coffee.jsmode-coldfusion.jsmode-csharp.jsmode-css.jsmode-curly.jsmode-d.jsmode-dart.jsmode-diff.jsmode-django.jsmode-dockerfile.jsmode-dot.jsmode-ejs.jsmode-erlang.jsmode-forth.jsmode-ftl.jsmode-gherkin.jsmode-glsl.jsmode-golang.jsmode-groovy.jsmode-haml.jsmode-handlebars.jsmode-haskell.jsmode-haxe.jsmode-html.jsmode-html_completions.jsmode-html_ruby.jsmode-ini.jsmode-jack.jsmode-jade.jsmode-java.jsmode-javascript.jsmode-json.jsmode-jsoniq.jsmode-jsp.jsmode-jsx.jsmode-julia.jsmode-latex.jsmode-less.jsmode-liquid.jsmode-lisp.jsmode-livescript.jsmode-logiql.jsmode-lsl.jsmode-lua.jsmode-luapage.jsmode-lucene.jsmode-makefile.jsmode-markdown.jsmode-matlab.jsmode-mel.jsmode-mushcode.jsmode-mushcode_high_rules.jsmode-mysql.jsmode-nix.jsmode-objectivec.jsmode-ocaml.jsmode-pascal.jsmode-perl.jsmode-pgsql.jsmode-php.jsmode-plain_text.jsmode-powershell.jsmode-prolog.jsmode-properties.jsmode-protobuf.jsmode-python.jsmode-r.jsmode-rdoc.jsmode-rhtml.jsmode-ruby.jsmode-rust.jsmode-sass.jsmode-scad.jsmode-scala.jsmode-scheme.jsmode-scss.jsmode-sh.jsmode-sjs.jsmode-smarty.jsmode-snippets.jsmode-soy_template.jsmode-space.jsmode-sql.jsmode-stylus.jsmode-svg.jsmode-tcl.jsmode-tex.jsmode-text.jsmode-textile.jsmode-toml.jsmode-twig.jsmode-typescript.jsmode-vala.jsmode-vbscript.jsmode-velocity.jsmode-verilog.jsmode-vhdl.jsmode-xml.jsmode-xquery.jsmode-yaml.js
jquery.sortable.jsmember.jssnippets
abap.jsactionscript.jsada.jsapache_conf.jsapplescript.jsasciidoc.jsassembly_x86.jsautohotkey.jsbatchfile.jsc9search.jsc_cpp.jscirru.jsclojure.jscobol.jscoffee.jscoldfusion.jscsharp.jscss.jscurly.jsd.jsdart.jsdiff.jsdjango.jsdockerfile.jsdot.jsejs.jserlang.jsforth.jsftl.jsgherkin.jsglsl.jsgolang.jsgroovy.jshaml.jshandlebars.jshaskell.jshaxe.jshtml.jshtml_completions.jshtml_ruby.jsini.jsjack.jsjade.jsjava.jsjavascript.jsjson.jsjsoniq.jsjsp.jsjsx.jsjulia.jslatex.jsless.jsliquid.jslisp.jslivescript.jslogiql.jslsl.jslua.jsluapage.jslucene.jsmakefile.jsmarkdown.jsmatlab.jsmel.jsmushcode.jsmushcode_high_rules.jsmysql.jsnix.jsobjectivec.jsocaml.jspascal.jsperl.jspgsql.jsphp.jsplain_text.jspowershell.jsprolog.jsproperties.jsprotobuf.jspython.jsr.jsrdoc.jsrhtml.jsruby.jsrust.jssass.jsscad.jsscala.jsscheme.jsscss.jssh.jssjs.jssmarty.jssnippets.jssoy_template.jsspace.jssql.jsstylus.jssvg.jstcl.jstex.jstext.jstextile.jstoml.jstwig.jstypescript.jsvala.jsvbscript.jsvelocity.jsverilog.jsvhdl.jsxml.jsxquery.jsyaml.js
theme-ambiance.jstheme-chaos.jstheme-chrome.jstheme-cloud9_day.jstheme-cloud9_night.jstheme-cloud9_night_low_color.jstheme-clouds.jstheme-clouds_midnight.jstheme-cobalt.jstheme-crimson_editor.jstheme-dawn.jstheme-dreamweaver.jstheme-eclipse.jstheme-github.jstheme-idle_fingers.jstheme-katzenmilch.jstheme-kr.jstheme-kuroir.jstheme-merbivore.jstheme-merbivore_soft.jstheme-mono_industrial.jstheme-monokai.jstheme-pastel_on_dark.jstheme-solarized_dark.jstheme-solarized_light.jstheme-terminal.jstheme-textmate.jstheme-tomorrow.jstheme-tomorrow_night.jstheme-tomorrow_night_blue.jstheme-tomorrow_night_bright.jstheme-tomorrow_night_eighties.jstheme-twilight.jstheme-vibrant_ink.jstheme-xcode.jsworker-coffee.jsworker-css.jsworker-html.jsworker-javascript.jsworker-json.jsworker-lua.jsworker-php.jsworker-xquery.js
122
app/lea/File.go
122
app/lea/File.go
@ -1,10 +1,11 @@
|
||||
package lea
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"path/filepath"
|
||||
"os"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 分离文件名与扩展名(包含.)
|
||||
@ -14,14 +15,14 @@ func SplitFilename(filename string) (baseName, ext string) {
|
||||
ext = SubstringByte(filename, strings.LastIndex(filename, "."))
|
||||
baseName = strings.TrimRight(filename, ext)
|
||||
ext = strings.ToLower(ext)
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
// 转换文件的格式
|
||||
// toExt包含.
|
||||
func TransferExt(path string, toExt string) string {
|
||||
dir := filepath.Dir(path) + "/" // 文件路径
|
||||
name := filepath.Base(path) // 文件名 a.jpg
|
||||
dir := filepath.Dir(path) + "/" // 文件路径
|
||||
name := filepath.Base(path) // 文件名 a.jpg
|
||||
// 获取文件名与路径
|
||||
baseName, _ := SplitFilename(name)
|
||||
return dir + baseName + toExt
|
||||
@ -38,7 +39,7 @@ func GetFilesize(path string) int64 {
|
||||
if err == nil {
|
||||
return fileinfo.Size()
|
||||
}
|
||||
return 0;
|
||||
return 0
|
||||
}
|
||||
|
||||
// 清空dir下所有的文件和文件夹
|
||||
@ -79,12 +80,103 @@ func CopyFile(srcName, dstName string) (written int64, err error) {
|
||||
return io.Copy(dst, src)
|
||||
}
|
||||
|
||||
func CopyDir(source string, dest string) (err error) {
|
||||
// get properties of source dir
|
||||
sourceinfo, err := os.Stat(source)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// create dest dir
|
||||
|
||||
err = os.MkdirAll(dest, sourceinfo.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
directory, _ := os.Open(source)
|
||||
|
||||
objects, err := directory.Readdir(-1)
|
||||
|
||||
for _, obj := range objects {
|
||||
|
||||
sourcefilepointer := source + "/" + obj.Name()
|
||||
|
||||
destinationfilepointer := dest + "/" + obj.Name()
|
||||
|
||||
if obj.IsDir() {
|
||||
// create sub-directories - recursively
|
||||
err = CopyDir(sourcefilepointer, destinationfilepointer)
|
||||
if err != nil {
|
||||
// fmt.Println(err)
|
||||
}
|
||||
} else {
|
||||
// perform copy
|
||||
_, err = CopyFile(sourcefilepointer, destinationfilepointer)
|
||||
if err != nil {
|
||||
// fmt.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func DeleteFile(path string) bool {
|
||||
err := os.Remove(path)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func IsDirExists(path string) bool {
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return os.IsExist(err)
|
||||
}else{
|
||||
return fi.IsDir()
|
||||
}
|
||||
return false
|
||||
}
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return os.IsExist(err)
|
||||
} else {
|
||||
return fi.IsDir()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 获得文件str内容
|
||||
func GetFileStrContent(path string) string {
|
||||
fileBytes, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return string(fileBytes)
|
||||
}
|
||||
|
||||
func IsFileExist(filename string) bool {
|
||||
var exist = true
|
||||
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
||||
exist = false
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// 写入string内容
|
||||
func PutFileStrContent(path, content string) bool {
|
||||
var f *os.File
|
||||
var err1 error
|
||||
defer (func() {
|
||||
if f != nil {
|
||||
f.Close()
|
||||
}
|
||||
})()
|
||||
f, err1 = os.OpenFile(path, os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0666) //打开文件
|
||||
// Log(err1)
|
||||
// var n int
|
||||
_, err1 = io.WriteString(f, content) //写入文件(字符串)
|
||||
// Log(content)
|
||||
// Log(err1)
|
||||
// Log(n)
|
||||
// Log(path)
|
||||
|
||||
if err1 != nil {
|
||||
Log(err1)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
Reference in New Issue
Block a user