Reputation: 9670
My absolute path works for me :
const string fileName =
@"C:\Udvikling\MapEditor\MapEditorProject\Data\Track1.xml";
But I want a relative path. I try'ed :
const string fileName = @"~\Data\Track1.xml";
I get this Error:
"Could not find a part of the path C:\Udvikling\RollerApp\RollerGame\MapEditorProject\bin\Debug\~\Data\Track1.xml'"
Upvotes: 0
Views: 2214
Reputation: 62276
Do not add ~
character and use Path.Combine method to combine 2 paths.
More or less like this:
const string fileName = @"\Data\Track1.xml";
string combinedPath = Path.Combine(@"C:\Udvikling\RollerApp\RollerGame\MapEditorProject\bin\Debug",
fileName);
Hope this helps.
Upvotes: 1