mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-09-11 18:30:14 -07:00
Merge pull request #317 from bob-zebedy/fix/pyinstaller-bin-path
fix: resolve binary tools detection after PyInstaller packaging
This commit is contained in:
@@ -31,7 +31,9 @@ from chameleon_utils import (
|
||||
execute_tool,
|
||||
tqdm_if_exists,
|
||||
print_key_table,
|
||||
default_cwd
|
||||
)
|
||||
|
||||
from chameleon_utils import CLITree
|
||||
from chameleon_utils import CR, CG, CB, CC, CY, C0, color_string
|
||||
from chameleon_utils import print_mem_dump
|
||||
@@ -67,8 +69,6 @@ type_id_SAK_dict = {
|
||||
0x38: "SmartMX with MIFARE Classic 4K",
|
||||
}
|
||||
|
||||
default_cwd = Path.cwd() / Path(__file__).with_name("bin")
|
||||
|
||||
|
||||
def load_key_file(import_key, keys):
|
||||
"""
|
||||
|
||||
@@ -24,7 +24,20 @@ CY = colorama.Fore.YELLOW
|
||||
CM = colorama.Fore.MAGENTA
|
||||
C0 = colorama.Style.RESET_ALL
|
||||
|
||||
default_cwd = Path.cwd() / Path(__file__).with_name("bin")
|
||||
|
||||
def get_resource_dir(relative_path: str):
|
||||
"""
|
||||
Get the resource directory of the program.
|
||||
Returns the temporary directory where files are extracted after being packaged with PyInstaller, or the directory where the script is located in the development environment.
|
||||
"""
|
||||
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||||
base_dir = Path(sys._MEIPASS)
|
||||
else:
|
||||
base_dir = Path(__file__).parent
|
||||
return base_dir / relative_path
|
||||
|
||||
|
||||
default_cwd = get_resource_dir("bin")
|
||||
|
||||
|
||||
class ArgsParserError(Exception):
|
||||
|
||||
Reference in New Issue
Block a user