Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pyocd/target/pack/cmsis_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Copyright (c) 2020 Men Shiyun
# Copyright (c) 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
# Copyright (c) 2021-2023 Chris Reed
# Copyright (c) 2025 Morten Engelhardt Olsen
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -25,6 +26,7 @@
import io
import errno
from pathlib import Path
import posixpath
from typing import (Any, Callable, Dict, List, IO, Optional, Tuple, TypeVar, Set, Union)

from .flash_algo import PackFlashAlgo
Expand Down Expand Up @@ -193,12 +195,12 @@ def get_file(self, filename: str) -> IO[bytes]:
"""@brief Return file-like object for a file within the pack.

@param self
@param filename Relative path within the pack. May use forward or back slashes.
@param filename Relative path within the pack. May use forward or back slashes and '..'.
@return A BytesIO object is returned that contains all of the data from the file
in the pack. This is done to isolate the returned file from how the pack was
opened (due to particularities of the ZipFile implementation).
"""
filename = filename.replace('\\', '/')
filename = posixpath.normpath(filename.replace('\\', '/'))

# Some vendors place their pdsc in some subdirectories of the pack archive,
# use relative directory to the pdsc file while reading other files.
Expand Down
Loading