Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Handle Windows reserved filenames

Open Marinovsky opened this issue 1 year ago • 0 comments

Description

These changes aims to handle the cases when LEAN needs to write a file using a path that contains a Windows reserved filename. The methods added provide a stream(or just the fixed path) using a path accepted by the OS. A Regex expression finds the reserved filename in the path and replaces it for the same filename but with a @ character ahead.

Related Issue

Closes #3849

Motivation and Context

This change will handle the cases when LEAN needs to write a file using a path that contains a Windows reserved filename

Requires Documentation Change

N/A

How Has This Been Tested?

I created a collection of unit tests that asserted the path returned by Extensions.ToValidPath() and Extensions.FromValidPath() was the expected one in different scenarios that could arise in LEAN. I also asserted the behavior of LeanDataWriter when the path contained a Windows reserved filename.

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] Refactor (non-breaking change which improves implementation)
  • [ ] Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Non-functional change (xml comments/documentation/etc)

Checklist:

  • [x] My code follows the code style of this project.
  • [x] I have read the CONTRIBUTING document.
  • [x] I have added tests to cover my changes.
  • [x] All new and existing tests passed.
  • [x] My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

Marinovsky avatar Feb 15 '24 17:02 Marinovsky