This commit is contained in:
20
utils/folder/folder.go
Normal file
20
utils/folder/folder.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package folder
|
||||
|
||||
/*
|
||||
#cgo windows LDFLAGS: -lole32 -luuid
|
||||
|
||||
#include "windows_dialog.h"
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// OpenFolderDialog 调用Windows原生文件夹选择对话框
|
||||
// 返回选择的文件夹路径,如果用户取消选择则返回空字符串
|
||||
func OpenFolderDialog() string {
|
||||
cPath := C.OpenFolderDialog()
|
||||
if cPath == nil {
|
||||
return ""
|
||||
}
|
||||
defer C.FreeMemory(cPath)
|
||||
|
||||
return C.GoString(cPath)
|
||||
}
|
||||
Reference in New Issue
Block a user