Commit | Line | Data |
---|---|---|
3719602c PC |
1 | #!/usr/bin/env python3 |
2 | ||
3 | import core_opt_translation as t | |
4 | ||
5 | ||
6 | if __name__ == '__main__': | |
7 | _core_name = 'core_options' | |
8 | ||
9 | try: | |
10 | if t.os.path.isfile(t.sys.argv[1]): | |
11 | _temp = t.os.path.dirname(t.sys.argv[1]) | |
12 | else: | |
13 | _temp = t.sys.argv[1] | |
14 | while _temp.endswith('/') or _temp.endswith('\\'): | |
15 | _temp = _temp[:-1] | |
16 | TARGET_DIR_PATH = _temp | |
17 | except IndexError: | |
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) | |
20 | ||
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') | |
23 | ||
24 | _core_name = t.clean_file_name(_core_name) | |
25 | ||
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) | |
31 | ||
32 | _source_jsons = t.h2json(_files) | |
33 | ||
34 | print('\nAll done!') |