diff options
-rw-r--r-- | bittorrent.cabal | 3 | ||||
-rw-r--r-- | src/System/Torrent/Tree.hs (renamed from src/Data/Torrent/Tree.hs) | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/bittorrent.cabal b/bittorrent.cabal index 292680dd..0ceec550 100644 --- a/bittorrent.cabal +++ b/bittorrent.cabal | |||
@@ -50,7 +50,6 @@ library | |||
50 | hs-source-dirs: src | 50 | hs-source-dirs: src |
51 | exposed-modules: Data.Torrent | 51 | exposed-modules: Data.Torrent |
52 | Data.Torrent.Progress | 52 | Data.Torrent.Progress |
53 | Data.Torrent.Tree | ||
54 | Network.BitTorrent | 53 | Network.BitTorrent |
55 | Network.BitTorrent.Address | 54 | Network.BitTorrent.Address |
56 | Network.BitTorrent.Client | 55 | Network.BitTorrent.Client |
@@ -87,11 +86,13 @@ library | |||
87 | Network.BitTorrent.Internal.Cache | 86 | Network.BitTorrent.Internal.Cache |
88 | Network.BitTorrent.Internal.Types | 87 | Network.BitTorrent.Internal.Types |
89 | System.Torrent.FileMap | 88 | System.Torrent.FileMap |
89 | System.Torrent.Tree | ||
90 | else | 90 | else |
91 | other-modules: | 91 | other-modules: |
92 | Network.BitTorrent.Internal.Cache | 92 | Network.BitTorrent.Internal.Cache |
93 | Network.BitTorrent.Internal.Types | 93 | Network.BitTorrent.Internal.Types |
94 | System.Torrent.FileMap | 94 | System.Torrent.FileMap |
95 | System.Torrent.Tree | ||
95 | 96 | ||
96 | build-depends: base == 4.* | 97 | build-depends: base == 4.* |
97 | , lifted-base | 98 | , lifted-base |
diff --git a/src/Data/Torrent/Tree.hs b/src/System/Torrent/Tree.hs index 5825422f..41cfb360 100644 --- a/src/Data/Torrent/Tree.hs +++ b/src/System/Torrent/Tree.hs | |||
@@ -10,7 +10,7 @@ | |||
10 | {-# LANGUAGE FlexibleInstances #-} | 10 | {-# LANGUAGE FlexibleInstances #-} |
11 | {-# LANGUAGE TemplateHaskell #-} | 11 | {-# LANGUAGE TemplateHaskell #-} |
12 | {-# LANGUAGE DeriveDataTypeable #-} | 12 | {-# LANGUAGE DeriveDataTypeable #-} |
13 | module Data.Torrent.Tree | 13 | module System.Torrent.Tree |
14 | ( -- * Directory tree | 14 | ( -- * Directory tree |
15 | DirTree (..) | 15 | DirTree (..) |
16 | 16 | ||
@@ -18,7 +18,7 @@ module Data.Torrent.Tree | |||
18 | , build | 18 | , build |
19 | 19 | ||
20 | -- * Query | 20 | -- * Query |
21 | , Data.Torrent.Tree.lookup | 21 | , System.Torrent.Tree.lookup |
22 | , lookupDir | 22 | , lookupDir |
23 | , fileNumber | 23 | , fileNumber |
24 | , dirNumber | 24 | , dirNumber |
@@ -61,13 +61,13 @@ build MultiFile {..} = Dir $ M.singleton liDirName files | |||
61 | lookup :: [FilePath] -> DirTree a -> Maybe (DirTree a) | 61 | lookup :: [FilePath] -> DirTree a -> Maybe (DirTree a) |
62 | lookup [] t = Just t | 62 | lookup [] t = Just t |
63 | lookup (p : ps) (Dir m) | Just subTree <- M.lookup (BC.pack p) m | 63 | lookup (p : ps) (Dir m) | Just subTree <- M.lookup (BC.pack p) m |
64 | = Data.Torrent.Tree.lookup ps subTree | 64 | = System.Torrent.Tree.lookup ps subTree |
65 | lookup _ _ = Nothing | 65 | lookup _ _ = Nothing |
66 | 66 | ||
67 | -- | Lookup directory by path. | 67 | -- | Lookup directory by path. |
68 | lookupDir :: [FilePath] -> DirTree a -> Maybe [(ByteString, DirTree a)] | 68 | lookupDir :: [FilePath] -> DirTree a -> Maybe [(ByteString, DirTree a)] |
69 | lookupDir ps d = do | 69 | lookupDir ps d = do |
70 | subTree <- Data.Torrent.Tree.lookup ps d | 70 | subTree <- System.Torrent.Tree.lookup ps d |
71 | case subTree of | 71 | case subTree of |
72 | File _ -> Nothing | 72 | File _ -> Nothing |
73 | Dir es -> Just $ M.toList es | 73 | Dir es -> Just $ M.toList es |