MarsOne Posted August 10, 2016 Share Posted August 10, 2016 (edited) Hi XVM-Developer, i have a simple but good improvement proposal for the JSONxLoader. Let's say, you make a mistake with a reference entry like this for example ... ${ "battleLabelTemplates.xc":"def.totalHP" } // ${ "battleLabelsTemplates.xc":"def.totalHP" } ... Just a forgotten 's' in battleLabelsTemplates.xc... Now you get as error notification just this: JSONxLoaderException: File not found But you have no idea, which filename you make this mistake with. Now, lets change the WorldofTanks\res_mods\mods\xfw\python\lib\JSONxLoader\loader.pyc in line 85ff (95) def load_file(self, path, encoding = 'utf-8-sig'): import codecs if path in self.file_cache: return self.file_cache[path] else: try: stream = codecs.open(path, 'r', encoding) self.file_cache[path] = stream.read() if self.log_func is not None: self.log_func('[JSONxLoader] load: {}'.format(path)) stream.close() return self.file_cache[path] except IOError as e: raise JSONxLoaderException('File not found', e.filename) return to this def load_file(self, path, encoding = 'utf-8-sig'): import codecs if path in self.file_cache: return self.file_cache[path] else: try: stream = codecs.open(path, 'r', encoding) self.file_cache[path] = stream.read() if self.log_func is not None: self.log_func('[JSONxLoader] load: {}'.format(path)) stream.close() return self.file_cache[path] except IOError as e: raise JSONxLoaderException('File not found: {}'.format(e.filename), e.filename) return Then you get in case of Exeption also the filename which could not found! JSONxLoaderException: File not found: res_mods\configs\xvm\default\battleLabelTemplates.xc Great, or not? What do you think. I guess it will be very helpful. Edit: As an additional enhancement, maybe you could add the row and line position of the wrong reference at to message like we know it from your XVM :) Friendly regards MarsOne Edited August 10, 2016 by MarsOne 2 @ Quote Link to comment Short link Share on other sites More sharing options...
sirmax Posted August 10, 2016 Share Posted August 10, 2016 Done, thanks. 3 @ Quote Link to comment Short link Share on other sites More sharing options...
MarsOne Posted August 10, 2016 Author Share Posted August 10, 2016 (edited) Thanks very much. Maybe you can help me now. I don't use any specific vehicle names. Thats why i use in my config this: { "vehicleNames": { "$ref": { "file":"../../default/vehicleNames.xc", "path":"vehicleNames" } } } My config is subfolder /user.. So i go two folders up and then to the default folder. What's the correct entry for 'hardcoded' (sry for my poor english) config-folder? This is not correct: { "vehicleNames": { "$ref": { "file":"cfg://default/vehicleNames.xc", "path":"vehicleNames" } } } Do you understand and can help me? "src" & "cfg"? MarsOne Edited August 10, 2016 by MarsOne @ Quote Link to comment Short link Share on other sites More sharing options...
sirmax Posted August 10, 2016 Share Posted August 10, 2016 Sorry, but JSONx refs are supporting only relative paths. 1 @ Quote Link to comment Short link Share on other sites More sharing options...
MarsOne Posted August 10, 2016 Author Share Posted August 10, 2016 ok thx @ Quote Link to comment Short link Share on other sites More sharing options...
Kotyarko_O Posted August 10, 2016 Share Posted August 10, 2016 I don't use any specific vehicle names. You can delete "vehicleNames" section at all. Then XVM will use default values. @ Quote Link to comment Short link Share on other sites More sharing options...
kupjones Posted August 10, 2016 Share Posted August 10, 2016 Done, thanks. That was easy!! @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.