Std::string to juce::File?

So, I have a .txt file that has URL paths of a few files in it (files starting with C:\Users…). As I am using the std::getline, those paths are seen as std::string. I need to make a few operations on the files themselves, and therefore my question is, is there a way to convert those strings into juce::File?

The File class has a constructor that takes a String, and String has a constructor that takes a std::string. Since the String constructor is not explicit, you can just pass the std::string directly to the File constructor:

std::string myPath = "/Path/To/My/File";
juce::File myFile (myPath);
// do stuff with myFile...
2 Likes

That’s exactly what I was looking for. Thank you!