Skip to content

Commit

Permalink
调整细节
Browse files Browse the repository at this point in the history
Signed-off-by: allan716 <[email protected]>
  • Loading branch information
allanpk716 committed Nov 29, 2022
1 parent f4e6262 commit 7a7616f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 1 addition & 4 deletions folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ func ClearRodTmpRootFolder(nowProcessRoot string) error {
func GetTmpFolderByName(nowProcessRoot, folderName string) string {
rootPath := GetRodTmpRootFolder(nowProcessRoot)
tmpFolderFullPath := filepath.Join(rootPath, folderName)
err := os.MkdirAll(tmpFolderFullPath, os.ModePerm)
if err != nil {
logger.Panicln(err)
}
_ = os.MkdirAll(tmpFolderFullPath, os.ModePerm)
return tmpFolderFullPath
}

Expand Down
8 changes: 5 additions & 3 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ func WriteFile(desFileFPath string, bytes []byte) error {
}
// 创建对应的目录
nowDirPath := filepath.Dir(nowDesPath)
err = os.MkdirAll(nowDirPath, os.ModePerm)
if err != nil {
return err
if IsDir(nowDirPath) == false {
err = os.MkdirAll(nowDirPath, os.ModePerm)
if err != nil {
return err
}
}
file, err := os.Create(nowDesPath)
if err != nil {
Expand Down

0 comments on commit 7a7616f

Please sign in to comment.