tongkuisu
Topic Author
Posts: 12
Joined: 17 Jun 2021, 10:09

What is the current directory?

31 Dec 2021, 10:35

I'm intergate noesis to o3de, create a gem named noesisgem, and in one file named NoesisManager.cpp called this code
Noesis::GUI::SetXamlProvider(MakePtr<LocalXamlProvider>("."));
Noesis::GUI::SetFontProvider(MakePtr<LocalFontProvider>("."));
Noesis::GUI::SetTextureProvider(MakePtr<LocalTextureProvider>("."));
企业微信截图_16409430306100.png
should I put the Test.xaml the same diretory of NoesisManager.cpp ?
Here is the Test.xaml, I just use this line to load, but it return null
Noesis::Ptr<Noesis::Grid> xaml = Noesis::GUI::LoadXaml<Noesis::Grid>("Test.xaml");
Attachments
企业微信截图_16409431972025.png
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: What is the current directory?

03 Jan 2022, 10:52

The current directory depends on how you launch your application and what your application code does.
It could be the executable directory or the project folder if you run it from Visual Studio.
If you place the Test.xaml in your project folder and launch the application from Visual Studio it should be able to load the xaml with that code.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: What is the current directory?

03 Jan 2022, 18:03

LocalXamlProvider loads content from the current working directory but nothing stops you from creating your own provider implementation to load XAMLs from wherever you need. Our examples use EmbeddedXamlProvider to load from the executable itself.

Who is online

Users browsing this forum: Google [Bot] and 90 guests