Skip to content

Commit

Permalink
Use os.path.relpath instead of lstrip
Browse files Browse the repository at this point in the history
Using lstrip sometimes broken the folder names in wifi folder by removing
the "C" in the relpath.

A code similar to the following was added to debug:

if props:
    log.error(f"Unhandled properties found: {props} in file {relpath}")

assert not props

and the result was:

Unhandled properties found: {'': '4355'} in file -4355__s-C1/P-hawaii-ID_M-YSBC_V-m__m-2.3.txt
Traceback (most recent call last):
  File "/home/aditya/firmware.sh", line 905, in <module>
    wifi_col = WiFiFWCollection(sys.argv[1]+"/wifi")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aditya/firmware.sh", line 737, in __init__
    self.load(source_path)
  File "/home/aditya/firmware.sh", line 776, in load
    assert not props
AssertionError

Signed-off-by: Aditya Garg <gargaditya08@live.com>
  • Loading branch information
AdityaGarg8 committed May 31, 2024
1 parent 4086ab1 commit 8106e01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion asahi_firmware/wifi.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def load(self, source_path):
dirnames.remove("perf")
if "assert" in dirnames:
dirnames.remove("assert")
subpath = dirpath.lstrip(source_path)
subpath = os.path.relpath(dirpath, source_path)
for name in sorted(filenames):
if not any(name.endswith("." + i) for i in self.EXTMAP):
continue
Expand Down

0 comments on commit 8106e01

Please sign in to comment.