Skip to content

Files

Latest commit

 

History

History
19 lines (12 loc) · 548 Bytes

HardCodedWindowsRootDirectory.md

File metadata and controls

19 lines (12 loc) · 548 Bytes

Pattern: Hardcoded windows root directory

Issue: -

Description

This rule find cases where a File object is constructed with a windows-based path. This is not portable across operating systems or different machines, and using the File.listRoots() method is a better alternative.

Example of violations:

new File('c:\\')
new File('c:\\dir')
new File('E:\\dir')

Further Reading