1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """ Savers plugin manager """
24 from __future__ import print_function
25
26 import os.path
27
28 from fife import fife
29 from fife.extensions.serializers.xmlmapsaver import XMLMapSaver
30
31 mapFileMapping = { 'xml' : XMLMapSaver}
32 fileExtensions = ('xml',)
33
34 -def saveMapFile(path, engine, map, importList=[], debug=True):
35 """ save map file
36 @type path: string
37 @param path: The fully qualified path to the file to save
38 @type engine: object
39 @param engine: FIFE engine instance
40 @type map: object
41 @param map: FIFE map object
42 @type importList: list
43 @param importList: A list of all imports
44 @type debug: boolean
45 @param debug: Enables debugging information
46 """
47 (filename, extension) = os.path.splitext(path)
48 map.setFilename(path)
49 map_saver = mapFileMapping[extension[1:]](path, engine, map, importList)
50
51 map_saver.saveResource()
52 if debug: print("--- Saved Map.")
53 return map
54
56 """Add a new saver for fileextension
57 @type fileExtension: string
58 @param fileExtension: The file extension the saver is registered for
59 @type saverClass: object
60 @param saverClass: A fife.ResourceLoader implementation that saves maps
61 from files with the given fileExtension
62 """
63 mapFileMapping[fileExtension] = saverClass
64 _updateMapFileExtensions()
65
69