MarsOne 14 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 Share this post Link to post Short link Share on other sites
sirmax 5,499 #345071 Posted August 10, 2016 Done, thanks. 3 Quote Share this post Link to post Short link Share on other sites
MarsOne 14 #345079 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 Share this post Link to post Short link Share on other sites
sirmax 5,499 #345080 Posted August 10, 2016 Sorry, but JSONx refs are supporting only relative paths. 1 Quote Share this post Link to post Short link Share on other sites
MarsOne 14 #345081 Posted August 10, 2016 ok thx Quote Share this post Link to post Short link Share on other sites
Kotyarko_O 1,906 #345084 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 Share this post Link to post Short link Share on other sites
kupjones 30 #345112 Posted August 10, 2016 Done, thanks. That was easy!! Quote Share this post Link to post Short link Share on other sites