17
17
import subprocess
18
18
import sys
19
19
20
- from platformio .compat import path_to_unicode , WINDOWS
21
20
from platformio .project .exception import PlatformioException
22
- from platformio .project .helpers import load_project_ide_data
23
- from platformio .commands .device import DeviceMonitorFilter
21
+ from platformio .public import (
22
+ DeviceMonitorFilterBase ,
23
+ load_build_metadata ,
24
+ )
24
25
25
26
# By design, __init__ is called inside miniterm and we can't pass context to it.
26
27
# pylint: disable=attribute-defined-outside-init
27
28
29
+ IS_WINDOWS = sys .platform .startswith ("win" )
28
30
29
- class Esp32ExceptionDecoder (DeviceMonitorFilter ):
31
+
32
+ class Esp32ExceptionDecoder (DeviceMonitorFilterBase ):
30
33
NAME = "esp32_exception_decoder"
31
34
32
35
def __call__ (self ):
@@ -51,9 +54,9 @@ def __call__(self):
51
54
return self
52
55
53
56
def setup_paths (self ):
54
- self .project_dir = path_to_unicode ( os .path .abspath (self .project_dir ) )
57
+ self .project_dir = os .path .abspath (self .project_dir )
55
58
try :
56
- data = load_project_ide_data (self .project_dir , self .environment )
59
+ data = load_build_metadata (self .project_dir , self .environment )
57
60
self .firmware_path = data ["prog_path" ]
58
61
if not os .path .isfile (self .firmware_path ):
59
62
sys .stderr .write (
@@ -109,7 +112,7 @@ def rx(self, text):
109
112
110
113
def get_backtrace (self , match ):
111
114
trace = ""
112
- enc = "mbcs" if WINDOWS else "utf-8"
115
+ enc = "mbcs" if IS_WINDOWS else "utf-8"
113
116
args = [self .addr2line_path , u"-fipC" , u"-e" , self .firmware_path ]
114
117
try :
115
118
for i , addr in enumerate (match .group (1 ).split ()):
0 commit comments