Correct File path using Windows 10

Hi all,

I’m pretty new to Juce, so please bear with me.
I’m struggeling getting the file paths correctly set on Windows. I must have read each and every post about the construction of file paths but neither solution seems to work. Everytime I try to access a file I’m getting a null pointer. Currently I’m trying to load a vst Plugin into the This is my last try, to load a plugin dll:

[code]
		File test = File::getCurrentWorkingDirectory().getChildFile("C:\\Program Files\\Common Files\\VST3\\Nimbus.vst3");
		juce::String pluginPath = test.getFullPathName();
		OwnedArray<PluginDescription> pluginDescriptions;
		KnownPluginList plist;
		AudioPluginFormatManager pluginFormatManager;
		pluginFormatManager.addDefaultFormats();
		for (int i = 0; i < pluginFormatManager.getNumFormats(); ++i)
			plist.scanAndAddFile(pluginPath,
				true,
				pluginDescriptions,
				*pluginFormatManager.getFormat(i));

		jassert(pluginDescriptions.size() > 0);
		String msg;
		VstInstance = pluginFormatManager.createPluginInstance(*pluginDescriptions[0],
			48000,
			512,
			msg);
[\code]

pluginDescriptions.size() always returns zero. I’ not a hundred percent sure it’s related to the file name, since the the defaultFormat array appears to be empty as well (pluginFormatManager.addDefaultFormats() not working?). But since I unsuccesfully tried to load an XML file in the past, I guess it must have something to do with the file Path.
Can you please provide me with a working piece of code to construct a file path on Windows? I’m using Juce 5.4.5 under Windows 10, compiling with CS 2019.
Please help me, I’ getting really frustrated!
Thanks a lot
Patrick

Hi,
since you said the getNumFormats appears to return 0, I guess you didn’t switch on the formats:

Also creating the File test is wrong, you should only add one level in each getChildFile() call.
And getCurrentWorkingDirectory() is not the best choice, since nobody knows what that is if you click on the file in explorer. It is only a sensible value if you run from a terminal, but that is unlikely.

Instead look at File::getSpecialLocation(), for testing I usually use File::userDesktopDirectory, and move later to an appropriate folder, once I know my code works.

Thanks a lot for the hint regarding the Jucer config option (I tried to set the variable manually, but it always reverted to zero)! Looks like it’s not crashing any longer. I will have some tests with the filename tomorrow.
Once again thanks for the ultra quick reply!