79374396

Date: 2025-01-21 12:28:56
Score: 0.5
Natty:
Report link

When using Path.Combine, you are not supposed to add leading or trailing backslashes (\\). Leading backslash is an instruction to discard all path info and start from the root, and produces @"\files\file.csv".

This works:

string path = Path.Combine (dirLoc, "files\\file.csv");

Or this (for better cross platform support):

string path = Path.Combine (dirLoc, "files", "file.csv");
Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): When
  • Low reputation (0.5):
Posted by: jaros