Reputation: 184
public void LoadRegionMaps()
{
for (int x = 9; x < 10; x++)
{
for (int y = 9; y < 10; y++)
{
string path = RegionData[x, y, 1];
System.Console.Write("Opening File...");
if(path != "0")
{
System.Console.Write(path);
string[] fileText = File.ReadAllLines(path);
The paths in the .txt file look like this:
"..\\Bin\\Assets\\WorldMap\\Regions\\Forest.txt"
I've tried changing it to
@"..\\Bin\\Assets\\WorldMap\\Regions\\Forest.txt"
Neither work.
Both result in the error in the title, during the last line of code I showed.
path = "..\\Bin\\Assets\\WorldMap\\Regions\\Forest.txt"
Works.
RegionData is a string array, holding the above filepaths.
Upvotes: 1
Views: 1142
Reputation: 6374
Remove the double \\
on the file and the "
. \\
is a escape sequence that translates to \
on C#, but that does not apply to data read from a file unless you code for that.
..\Bin\Assets\WorldMap\Regions\Forest.txt
Upvotes: 1