fix: linux cp theme failed
This commit is contained in:
parent
d769f4115d
commit
e2c140706e
51
output.go
51
output.go
|
@ -73,29 +73,40 @@ func (o *Outter) createDir(fp string) error {
|
||||||
|
|
||||||
// sourceCopy 资源拷贝 将主题的资源拷贝到目标文件夹中
|
// sourceCopy 资源拷贝 将主题的资源拷贝到目标文件夹中
|
||||||
func (o *Outter) sourceCopy() {
|
func (o *Outter) sourceCopy() {
|
||||||
var args []string
|
sourcePath := slash(fmt.Sprintf("./themes/%s/", o.Config.Theme))
|
||||||
|
destPath := slash("./dist/" + o.Config.SourceVersion + "/")
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "windows":
|
case "windows":
|
||||||
args = []string{"cmd.exe", "/C", "xcopy", "/e", "/y"}
|
// args = []string{"cmd.exe", "/C", "xcopy", "/e", "/y"}
|
||||||
default:
|
default:
|
||||||
args = []string{"cp", "-r"}
|
// mkdir
|
||||||
}
|
cssDir := fmt.Sprintf("%s/css", destPath)
|
||||||
themePath := slash(fmt.Sprintf("./themes/%s/", o.Config.Theme))
|
jsDir := fmt.Sprintf("%s/js", destPath)
|
||||||
destPath := slash("./dist/" + o.Config.SourceVersion + "/")
|
imagesDir := fmt.Sprintf("%s/images", destPath)
|
||||||
cmd := exec.Command(args[0], append(args[1:], themePath+"css", slash(destPath+"css/"))...)
|
if err := mkdir(cssDir); err != nil {
|
||||||
if err := cmd.Run(); err != nil {
|
sfault("mkdir css directory failed: %v", err)
|
||||||
sout(cmd.String())
|
}
|
||||||
sfault("copy theme css source failed: %v", err)
|
if err := mkdir(jsDir); err != nil {
|
||||||
}
|
sfault("mkdir js directory failed: %v", err)
|
||||||
cmd = exec.Command(args[0], append(args[1:], themePath+"js", slash(destPath+"js/"))...)
|
}
|
||||||
if err := cmd.Run(); err != nil {
|
if err := mkdir(imagesDir); err != nil {
|
||||||
sout(cmd.String())
|
sfault("mkdir images directory failed: %v", err)
|
||||||
sfault("copy theme js source failed: %v", err)
|
}
|
||||||
}
|
cmd := exec.Command("cp", "-r", sourcePath+"css", destPath)
|
||||||
cmd = exec.Command(args[0], append(args[1:], themePath+"images", slash(destPath+"images/"))...)
|
if err := cmd.Run(); err != nil {
|
||||||
if err := cmd.Run(); err != nil {
|
sout(cmd.String())
|
||||||
sout(cmd.String())
|
sfault("copy theme css source failed: %v", err)
|
||||||
sfault("copy theme images source failed: %v", err)
|
}
|
||||||
|
cmd = exec.Command("cp", "-r", sourcePath+"js", destPath)
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
sout(cmd.String())
|
||||||
|
sfault("copy theme js source failed: %v", err)
|
||||||
|
}
|
||||||
|
cmd = exec.Command("cp", "-r", sourcePath+"images", destPath)
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
sout(cmd.String())
|
||||||
|
sfault("copy theme images source failed: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue