Refactor exportFiles function

This commit is contained in:
Joe Lim committed 2023-06-18 16:36:47 +10:00
1 parent 03f1c3b44c
commit 475d11480b
3 files changed
+15 -40

No files matched your search

-22
View File
@@ -174,28 +174,6 @@ func errCrossDevice(err error) bool {
return err.(*os.LinkError).Err.(windows.Errno) == 17
}
func exportFiles(f string, fs []string, pwd string) {
envFile := fmt.Sprintf(`"%s"`, f)
var quotedFiles []string
for _, f := range fs {
quotedFiles = append(quotedFiles, fmt.Sprintf(`"%s"`, f))
}
envFiles := strings.Join(quotedFiles, gOpts.filesep)
envPWD := fmt.Sprintf(`"%s"`, pwd)
os.Setenv("f", envFile)
os.Setenv("fs", envFiles)
os.Setenv("PWD", envPWD)
if len(fs) == 0 {
os.Setenv("fx", envFile)
} else {
os.Setenv("fx", envFiles)
}
}
func quoteString(s string) string {
return fmt.Sprintf(`"%s"`, s)
}