Skip to content

Commit

Permalink
Workaround to clean out stale exported files on Windows
Browse files Browse the repository at this point in the history
The list of source files always use forward-slashes, so comparing
these to OS-specific paths always fail on Windows with back-slashes.
As a quick fix, just convert to forward-slashes for the comparison.

Thanks schwende for reporting and suggesting this fix!
  • Loading branch information
olofk committed Nov 17, 2023
1 parent b72d3ff commit df10b8d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fusesoc/capi2/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def export(self, dst_dir, flags={}):
FutureWarning,
)
if not os.path.isabs(f):

if os.path.exists(os.path.join(self.core_root, f)):
src = os.path.join(self.core_root, f)
elif os.path.exists(os.path.join(self.files_root, f)):
Expand All @@ -129,7 +128,7 @@ def export(self, dst_dir, flags={}):
for root, dirs, files in os.walk(dst_dir):
for f in files:
_abs_f = os.path.join(root, f)
if not os.path.relpath(_abs_f, dst_dir) in src_files:
if not os.path.relpath(_abs_f, dst_dir).replace("\\", "/") in src_files:
os.remove(_abs_f)

def _get_script_names(self, flags):
Expand Down

0 comments on commit df10b8d

Please sign in to comment.