SkywalkerJi / mdt

Yu-Gi-Oh! Master Duel Translation Script
https://ygo.御坂美琴.cn
GNU General Public License v3.0
688 stars 91 forks source link

在其它工作目录下无法通过绝对路径运行mdt GUI #58

Open rumia-san opened 2 years ago

rumia-san commented 2 years ago

Describe the bug 在其它工作路径下以绝对路径运行(如通过Everything搜索mdt.exe运行)会报错 因为mdt_cv.py的第81行是以相对路径加载文件'./data/hash.json'的

调用栈

Traceback (most recent call last):
  File "mdt_gui.py", line 15, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "mdt_service.py", line 4, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "mdt.py", line 11, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "mdt_cv.py", line 81, in <module>
FileNotFoundError: [Errno 2] No such file or directory: './data/hash.json'

To Reproduce 在其它的工作路径下通过绝对路径运行mdt.exe 如通过Everything搜索mdt.exe运行 或者在powershell里以绝对路径运行mdt.exe

Expected behavior 可以在其它目录下运行mdt.exe

Screenshots

Desktop (please complete the following information):

Additional context Add any other context about the problem here.