Page 1 of 1

What is the current directory?

Posted: 31 Dec 2021, 10:35
by tongkuisu
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");

Re: What is the current directory?

Posted: 03 Jan 2022, 10:52
by sfernandez
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.

Re: What is the current directory?

Posted: 03 Jan 2022, 18:03
by jsantos
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.