3 import core_opt_translation as t
6 if __name__ == '__main__':
7 _core_name = 'core_options'
10 if t.os.path.isfile(t.sys.argv[1]):
11 _temp = t.os.path.dirname(t.sys.argv[1])
14 while _temp.endswith('/') or _temp.endswith('\\'):
16 TARGET_DIR_PATH = _temp
18 TARGET_DIR_PATH = t.os.path.dirname(t.os.path.dirname(t.os.path.realpath(__file__)))
19 print("No path provided, assuming parent directory:\n" + TARGET_DIR_PATH)
21 DIR_PATH = t.os.path.dirname(t.os.path.realpath(__file__))
22 H_FILE_PATH = t.os.path.join(TARGET_DIR_PATH, 'libretro_core_options.h')
24 _core_name = t.clean_file_name(_core_name)
26 print('Getting texts from libretro_core_options.h')
27 with open(H_FILE_PATH, 'r+', encoding='utf-8') as _h_file:
28 _main_text = _h_file.read()
29 _hash_n_str = t.get_texts(_main_text)
30 _files = t.create_msg_hash(DIR_PATH, _core_name, _hash_n_str)
32 _source_jsons = t.h2json(_files)