Skip to content

Commit

Permalink
feat(paths): rclone path
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikvedvik committed Nov 1, 2023
1 parent ffefd7f commit 7d28240
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 2 additions & 10 deletions utils/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,7 @@ func (p Path) RcloneFsRemote() (string, string) {
}

func (p Path) RclonePath() string {
switch p.Drive {
case IsilonDrive:
return filepath.Join("isilon:isilon", p.Path)
case DMZShareDrive:
return filepath.Join("dmz:dmzshare", p.Path)
case TempDrive:
return filepath.Join("temp:temp", p.Path)
}
return ""
return filepath.Join(drivePrefixes[p.Drive].Rclone, p.Path)
}

func (p Path) BatonPath() string {
Expand Down Expand Up @@ -118,7 +110,7 @@ type prefix struct {
var drivePrefixes = map[Drive]prefix{
IsilonDrive: {"/mnt/isilon/", GetIsilonPrefix(), "isilon:isilon/"},
DMZShareDrive: {"/mnt/dmzshare/", "/mnt/dmzshare/", "dmz:dmzshare/"},
TempDrive: {"/mnt/temp/", GetTempMountPrefix(), "temp:temp/"},
TempDrive: {"/mnt/temp/", GetTempMountPrefix(), "isilon:temp/"},
}

func ParsePath(path string) (Path, error) {
Expand Down
2 changes: 2 additions & 0 deletions utils/paths_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ func Test_ParsePath(t *testing.T) {

assert.Equal(t, IsilonDrive, path.Drive)
assert.Equal(t, "test.xml", path.Path)

assert.Equal(t, "isilon:isilon/test.xml", path.RclonePath())
}

0 comments on commit 7d28240

Please sign in to comment.