add support for a global temp path

Fixes #436
This commit is contained in:
Nicola Murino
2021-05-27 15:38:27 +02:00
parent 7a85c66ee7
commit 3b46e6a6fb
14 changed files with 76 additions and 23 deletions

View File

@@ -175,7 +175,11 @@ type SFTPFs struct {
// NewSFTPFs returns an SFTPFs object that allows to interact with an SFTP server
func NewSFTPFs(connectionID, mountPath, localTempDir string, forbiddenSelfUsernames []string, config SFTPFsConfig) (Fs, error) {
if localTempDir == "" {
localTempDir = filepath.Clean(os.TempDir())
if tempPath != "" {
localTempDir = tempPath
} else {
localTempDir = filepath.Clean(os.TempDir())
}
}
if err := config.Validate(); err != nil {
return nil, err