@@ -156,30 +156,26 @@ def run(self):
156
156
157
157
# Build the command content as a list, then convert to string.
158
158
content = []
159
+ cd_to = zephyr_app or app
159
160
comment = None
160
161
if len (host_os ) > 1 :
161
162
comment = '# On {}'
162
163
163
- if zephyr_app :
164
- if "unix" in host_os :
165
- if comment :
166
- content .append ('{}' .format (comment .format ('Linux/macOS' )))
167
- content .append ('cd $ZEPHYR_BASE/{}' .format (zephyr_app ))
168
- content .extend (self ._mkdir (mkdir , build_dir , "unix" ,
169
- skip_config , compact ))
170
- if comment :
171
- content .append ('' )
172
- if "win" in host_os :
173
- if comment :
174
- content .append ('{}' .format (comment .format ('Windows' )))
175
- zephyr_app = zephyr_app .replace ('/' ,'\\ ' )
176
- content .append ('cd %ZEPHYR_BASE%\{}' .format (zephyr_app ))
177
- content .extend (self ._mkdir (mkdir , build_dir , "win" ,
178
- skip_config , compact ))
179
- if not compact or comment :
180
- content .append ('' )
181
- elif app :
182
- content .append ('cd {}' .format (app ))
164
+ for host in host_os :
165
+ if cd_to :
166
+ if host == "unix" :
167
+ if comment :
168
+ content .append (comment .format ('Linux/macOS' ))
169
+ prefix = '$ZEPHYR_BASE/' if zephyr_app else ''
170
+ content .append ('cd {}{}' .format (prefix , cd_to ))
171
+ elif host == "win" :
172
+ if comment :
173
+ content .append (comment .format ('Windows' ))
174
+ prefix = '%ZEPHYR_BASE%\\ ' if zephyr_app else ''
175
+ backslashified = cd_to .replace ('/' , '\\ ' )
176
+ content .append ('cd {}{}' .format (prefix , backslashified ))
177
+ content .extend (self ._mkdir (mkdir , build_dir , host ,
178
+ skip_config , compact ))
183
179
if not compact :
184
180
content .append ('' )
185
181
0 commit comments