question

DavidLilley-9296 avatar image
1 Vote"
DavidLilley-9296 asked LouisWaweru edited

Working Directory MacOS App called from Terminal

We have a MacOS App built with Xamarin and we are implementing a Cmd Line Mode to use the program.

Unfortunately we don't have the correct working directory

We can call the App via

cd ~/Desktop
/Applications/MyApp.app/Contents/MacOS/MyApp -args1 -arg2

So if there is arguments I don't call the UI.

However Environment.CurrentDirectory is always set to NSBundle location and not to the Desktop, Is there anyway to find the current working directory from a MacOS App, that in this case would be the desktop?




dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LouisWaweru avatar image
0 Votes"
LouisWaweru answered LouisWaweru edited

This works on on a Mac:

string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

System.Runtime



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.