How does default/relative path resolution work in .NET?

后端 未结 4 645
南旧
南旧 2021-02-08 23:31

So... I used to think that when you accessed a file but specified the name without a path (CAISLog.csv in my case) that .NET would expect the file to reside at the same path as

4条回答
  •  Happy的楠姐
    2021-02-09 00:20

    Relative Path resolution never works against the path of the launching executable. It always works against the process' Current Directory, and you can't really expect that to always be set to the directory the .exe lives in.

    If you need that behavior, then take care to find out the right path on your own and provide a fully qualified path to the file operations.

提交回复
热议问题