equal
deleted
inserted
replaced
36 import EngineInteraction |
36 import EngineInteraction |
37 |
37 |
38 |
38 |
39 pickReplayFile :: Int -> [String] -> IO String |
39 pickReplayFile :: Int -> [String] -> IO String |
40 pickReplayFile p blackList = do |
40 pickReplayFile p blackList = do |
41 files <- liftM (filter (\f -> sameProto f && notBlacklisted f)) $ getDirectoryContents "replays" |
41 files <- liftM (filter (\f -> sameProto f && notBlacklisted ("replays/" ++ f))) $ getDirectoryContents "replays" |
42 if (not $ null files) then |
42 if (not $ null files) then |
43 return $ "replays/" ++ head files |
43 return $ "replays/" ++ head files |
44 else |
44 else |
45 return "" |
45 return "" |
46 where |
46 where |
47 sameProto = (isSuffixOf ('.' : show p)) |
47 sameProto = isSuffixOf ('.' : show p) |
48 notBlacklisted = flip notElem blackList |
48 notBlacklisted = flip notElem blackList |
49 |
49 |
50 saveReplay :: RoomInfo -> IO () |
50 saveReplay :: RoomInfo -> IO () |
51 saveReplay r = do |
51 saveReplay r = do |
52 let gi = fromJust $ gameInfo r |
52 let gi = fromJust $ gameInfo r |