golang mac 獲取當前應用程序目錄,文件名,相對路徑

import{ spa

"os/exec"
"path/filepath" import

} file


//文件完整路徑 im

filePath, _ := exec.LookPath(os.Args[0]) di

//文件相對路徑
dirPath := filepath.Dir(osPath) 


//文件名 文件

fileName := filepath.Base(osPath) path

相關文章
相關標籤/搜索