Skip to content

Commit e8d0e72

Browse files
Marti Bolivarnashif
authored andcommitted
doc: extensions: fix :app: behavior for zephyr-app-commands
The directive is not generating the right "mkdir" steps when used with the :app: option. Fix it. Signed-off-by: Marti Bolivar <[email protected]>
1 parent c6c1501 commit e8d0e72

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

doc/extensions/zephyr/application.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -156,30 +156,26 @@ def run(self):
156156

157157
# Build the command content as a list, then convert to string.
158158
content = []
159+
cd_to = zephyr_app or app
159160
comment = None
160161
if len(host_os) > 1:
161162
comment = '# On {}'
162163

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))
183179
if not compact:
184180
content.append('')
185181

0 commit comments

Comments
 (0)