Skip to content

Commit

Permalink
Fix windows path bug
Browse files Browse the repository at this point in the history
  • Loading branch information
iychoi committed Jan 31, 2023
1 parent d6f98d8 commit cbcf5b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions cmd/subcmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ func getOne(transferManager *commons.ParallelTransferManager, filesystem *irodsc
}

if sourceEntry.Type == irodsclient_fs.FileEntry {
logger.Debugf("downloading a data object %s to %s", sourcePath, targetPath)

targetFilePath := commons.EnsureTargetLocalFilePath(sourcePath, targetPath)

targetStat, err := os.Stat(targetFilePath)
Expand Down
8 changes: 3 additions & 5 deletions commons/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ func MakeIRODSPath(cwd string, homedir string, zone string, irodsPath string) st
}

func MakeLocalPath(localPath string) string {
if strings.HasPrefix(localPath, string(os.PathSeparator)) {
absLocalPath, err := filepath.Abs(localPath)
if err != nil {
return filepath.Clean(localPath)
}

wd, _ := os.Getwd()

newPath := filepath.Join(wd, localPath)
return filepath.Clean(newPath)
return filepath.Clean(absLocalPath)
}

func EnsureTargetIRODSFilePath(filesystem *irodsclient_fs.FileSystem, source string, target string) string {
Expand Down

0 comments on commit cbcf5b1

Please sign in to comment.