Skip to content

Commit 55f8934

Browse files
authored
target: pack: fix filename accessor for extracted packs
Make sure CmsisPack.filename does not throw an exception when an unzipped pack is used.
1 parent fd70a10 commit 55f8934

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pyocd/target/pack/cmsis_pack.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Copyright (c) 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
66
# Copyright (c) 2021-2023 Chris Reed
77
# Copyright (c) 2025 Morten Engelhardt Olsen
8+
# Copyright (c) 2026 Microchip Technology Inc.
89
# SPDX-License-Identifier: Apache-2.0
910
#
1011
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -179,7 +180,8 @@ def __init__(self, file_or_path: Union[str, zipfile.ZipFile, IO[bytes], Path]) -
179180
@property
180181
def filename(self) -> Optional[str]:
181182
"""@brief Accessor for the filename or path of the .pack file."""
182-
return self._pack_file.filename
183+
if not self._is_dir:
184+
return self._pack_file.filename
183185

184186
@property
185187
def pdsc(self) -> "CmsisPackDescription":

0 commit comments

Comments
 (0)