Compiled game detect where is installed?

I want my game to be able to work with files located in the “”_Data folder. I cant use a path like C://Unity/MyGame/ because the usar has to be able to install it anywhere. Even in another drive (D:// for example).

In C# you have the following command to get the current folder :

using System.IO;
...

 string path = Path.GetFullPath("./");

...

This will get you the current folder (where the .exe is). I don’t know if this is available in unity (since I don’t have access to my unity from where I’m writing).

Anyways, any relative folder you access will be relative to the working folder.

If you have a _Data folder in the root folder of your game, you can safely open a file from that folder by trying to access “./_Data/somefile.res”

Things can go wrong if the user launches the .exe from another folder . For example the app is located in

c:\MyGame\myGame.exe

and the user from calls from c:\

call .\MyGame\MyGame.exe