You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
412 B
27 lines
412 B
package file
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
func CreateFolder(userName, folderPath string) error {
|
|
|
|
// 获取main.go所在的目录
|
|
currentDir, err := os.Getwd()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
baseDir := filepath.Join(currentDir, "file_library")
|
|
|
|
fullFolderPath := filepath.Join(baseDir, userName, folderPath)
|
|
|
|
err = os.MkdirAll(fullFolderPath, 0755)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|