Stride Forums Archive

Getting path relative to exe

5 posts, 1183 views, 2017-02-13 to 2017-02-14

Maxdg (Max de Groot) 2017-02-13 #1

Hey everyone,

I’ve come from Unity to Xenko, and started porting my application to Xenko.
However I use Application.dataPath in Unity, but I don’t see any comparable code.

Am I missing something? Any way to get the relative dataPath?

Thanks

dfkeenan 2017-02-14 #2

You can try looking at the VirtualFileSystem class. You can use it to get a number of different paths, open files streams etc.

Maxdg (Max de Groot) 2017-02-14 #3

Hey dfkeenan.

Thanks for the reply, but I’ve found out the solution.

I’ve used System.Reflection.Assembly.GetEntryAssembly().Location to get the path to the exe.
I’ll look into VirtualFileSystem later to see if that works better.

Your welcome.

I think VirtualFileSystem is supposed to be a file system abstraction layer that will work on all supported platforms.

Maxdg (Max de Groot) 2017-02-14 #5 in reply to #4

I guessed yes. I’ll see if my solution also works on Linux, if it does I’ll stay with my current solution since this project won’t be pushed to mobile devices.