Skip to content

Commit 5222ae5

Browse files
committed
More MacOS stub_flasher tweaks
1 parent b90f730 commit 5222ae5

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

RTK_Firmware_Uploader/RTK_Firmware_Uploader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,10 @@ def on_upload_btn_pressed(self) -> None:
461461
pass
462462

463463

464-
base_path = os.path.abspath(os.path.dirname(__file__))
464+
head_tail = os.path.split(os.path.dirname(__file__))
465+
base_path = os.path.abspath(head_tail[0])
465466
self.writeMessage(base_path)
467+
self.writeMessage(head_tail[1])
466468

467469
self.flashSize = 0
468470

RTK_Firmware_Uploader/au_act_esptool.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77

88
if (system() == "Darwin"): # Fix for MacOS pyinstaller windowed executable
99

10-
# Python hackiness: change the path to stub json files in the context of the esptool
11-
# module, so it edits the esptool's global variables
12-
base_path = os.path.abspath(os.path.dirname(__file__))
13-
STUBS_DIR = os.path.join(base_path, "..", "Frameworks", "esptool", "targets", "stub_flasher")
14-
exec(
15-
"loader.STUBS_DIR = '{}'".format(STUBS_DIR),
16-
esptool.__dict__,
17-
esptool.__dict__,
18-
)
10+
head_tail = os.path.split(os.path.dirname(__file__))
11+
if (head_tail[1] == "RTK_Firmware_Uploader"): # Check if this is the Uploader executable
12+
base_path = os.path.abspath(head_tail[0])
13+
STUBS_DIR = os.path.join(base_path, "esptool", "targets", "stub_flasher")
14+
# Python hackiness: change the path to stub json files in the context of the esptool
15+
# module, so it edits the esptool's global variables
16+
exec(
17+
"loader.STUBS_DIR = '{}'".format(STUBS_DIR),
18+
esptool.__dict__,
19+
esptool.__dict__,
20+
)
1921

2022
#--------------------------------------------------------------------------------------
2123
# action testing

0 commit comments

Comments
 (0)