Because the "current working directory" (which is what "relative paths" are relative to) and the directory the *.exe is in are not always the same.
You can test it yourself. Make simple executable like this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 | #include <stdio.h>
int main(int argc, char **argv)
{
FILE *f = fopen("./test.txt","r");
if (f == NULL)
{
printf("File not found\n");
}
else
{
printf("File found\n");
}
return 0;
}
|
Then if you create a "test.txt" in the same diretory as the executable you will see a different output for
| C:\Location\to\exe> test.exe
File found
C:\Location\to\exe> cd ..
C:\Location\to> exe\test.exe
File not found
|
So if you code the path just relative to the cwd then shortcuts to your your game exe may suddenly not work (which is a terrible user experience).