1 // Copyright 2008 Brian Caine
3 // This file is part of Potpourri.
5 // Potpourri is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // Potpourri is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTIBILITY of FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Potpourri. If not, see <http://www.gnu.org/licenses/>.
21 // The source for the medialoader class.
27 #include "../../include/core/MediaLoader.h"
29 #include "../../include/core/common.h"
30 #include "../../include/core/cURLDirectory.h"
31 #include "../../include/core/LocalDirectory.h"
33 using namespace fragrant
;
35 MediaLoader::MediaLoader()
39 MediaLoader::~MediaLoader()
42 std::string
MediaLoader::loadMedia(std::string source
)
51 ParsedPath path
= parsePath(source
);
52 base
= path
.protocol
+ protocol_host_separator
+
53 path
.host
+ path_separator
;
56 catch (std::runtime_error
& e
)
60 relative
= splitPath(source
).size() &&
61 splitPath(source
).at(0) != (std::string("") + path_separator
);
64 base
= path_separator
;
73 LocalDirectory dir
= LocalDirectory(base
, plugin_map
);
74 results
= dir
.getFile(source
);
79 cURLDirectory dir
= cURLDirectory(base
, plugin_map
);
80 results
= dir
.getFile(source
);
86 std::map
<std::string
, archive_function
>& MediaLoader::plugins()
91 Game
* MediaLoader::getGame()
96 void MediaLoader::setGame(Game
* ngame
)