Files - NKS0023
Use Filesystem.NeutralizePath()
Last updated
Use Filesystem.NeutralizePath()
Last updated
This analyzer provides the following strings:
Context | String |
---|---|
This code analyzer detects the usage of GetFullPath
from the standard Path
class found in the System.IO
namespace.
While Path.GetFullPath()
operates on the executable project directory, it doesn't represent the state of the current working directory because the UESH shell doesn't use the built-in current working directory property.
NeutralizePath()
had to be made to not only solve this problem, but also gives you a unified path that has folder names spearated by the platform-agnostic path separator.
To get a brief insight about how this analyzer works, compare the two code blocks shown to you below:
You can suppress this suggestion by including it in the appropriate place, whichever is convenient.
For more information about how to suppress any warning issued by the Nitrocid analyzer, visit the below page:
We recommend that every caller which use this function use the recommended abovementioned method.
Error List
Caller uses Path.GetFullPath
instead of Filesystem.NeutralizePath()
Suggestion Box
Use Filesystem.NeutralizePath()
instead of Path.GetFullPath
Description
Filesystem.NeutralizePath()
neutralizes the provided path to its absolute correct path, but also gives a path separated by the platform-agnostic path separator.