Skip to content

Commit

Permalink
rename RootDirectory to Dir
Browse files Browse the repository at this point in the history
  • Loading branch information
cenkalti committed Sep 18, 2024
1 parent 77f2e4f commit 76968c9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion torrent/session_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (s *Session) runOnCompleteCmd(torrent *torrent) {

cmd.Env = append(os.Environ(),
"RAIN_TORRENT_ADDED="+fmt.Sprint(torrent.addedAt.Unix()),
"RAIN_TORRENT_DIR="+torrent.storage.RootDir(),
"RAIN_TORRENT_DIR="+torrent.Dir(),
"RAIN_TORRENT_HASH="+hex.EncodeToString(torrent.infoHash[:]),
"RAIN_TORRENT_ID="+torrent.id,
"RAIN_TORRENT_NAME="+torrent.name)
Expand Down
7 changes: 3 additions & 4 deletions torrent/session_torrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ func (t *Torrent) Name() string {
return t.torrent.Name()
}

// RootDirectory of the torrent.
// The directory that contains the files in the torrent.
func (t *Torrent) RootDirectory() string {
return t.torrent.RootDirectory()
// Dir returns the directory that contains the files in the torrent.
func (t *Torrent) Dir() string {
return t.torrent.Dir()
}

// Files in the torrent. An error is returned when metainfo isn't ready.
Expand Down
2 changes: 1 addition & 1 deletion torrent/torrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func (t *torrent) InfoHash() []byte {
return b
}

func (t *torrent) RootDirectory() string {
func (t *torrent) Dir() string {
return t.storage.RootDir()
}

Expand Down
4 changes: 2 additions & 2 deletions torrent/torrent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func TestDownloadTorrent(t *testing.T) {
assertCompleted(t, tor)
}

func TestTorrentRootDirectory(t *testing.T) {
func TestTorrentDir(t *testing.T) {
defer leaktest.Check(t)()
addr, cl := seeder(t, true)
defer cl()
Expand All @@ -162,7 +162,7 @@ func TestTorrentRootDirectory(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Equal(t, filepath.Join(s.config.DataDir, tor.ID()), tor.RootDirectory())
assert.Equal(t, filepath.Join(s.config.DataDir, tor.ID()), tor.Dir())
assertCompleted(t, tor)
}

Expand Down

0 comments on commit 76968c9

Please sign in to comment.