I have help for my app in .pdf format.
On Windows I can use ShellExecute to open it.
What can I do on Linux and on OSX to open and show this pdf?
I have help for my app in .pdf format.
On Windows I can use ShellExecute to open it.
What can I do on Linux and on OSX to open and show this pdf?
Open on Mac OS X ( https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/open.1.html ) can do that (with juce::ChildProcess)?
You could probably use File::startAsProcess(), if I understand you correctly.
Oops, i forgot that one
This is what I use now and it works:
juce::String fileName; #if JUCE_WINDOWS fileName = juce::File::getSpecialLocation(juce::File::invokedExecutableFile).getParentDirectory().getFullPathName() + "\\CNCUSBController.pdf"; #endif #if JUCE_LINUX fileName = juce::File::getSpecialLocation(juce::File::invokedExecutableFile).getParentDirectory().getFullPathName() + "/CNCUSBController.pdf"; #endif juce::File file(fileName); if (file.existsAsFile()) { juce::Process::openDocument("file:" + fileName, juce::String::empty); } else { juce::AlertWindow::showMessageBox(juce::AlertWindow::WarningIcon, "Warning", "Help file does not exist!", juce::String::empty, nullptr); }
Ouch! Please never use raw strings to create path names!
Always use methods like File::getChildfile, which avoids this kind of messy, non-DRY and error-prone code!
Thank you. This looks much better. Your help is very appreciated.
juce::File file = juce::File::getSpecialLocation(juce::File::invokedExecutableFile).getParentDirectory().getChildFile("CNCUSBController.pdf");
if (file.existsAsFile())
{
juce::Process::openDocument("file:" + file.getFullPathName(), juce::String::empty);
}
else
{
juce::AlertWindow::showMessageBox(juce::AlertWindow::WarningIcon, "Warning", "Help file does not exist!", juce::String::empty, nullptr);
}
getSiblingFile would have been even better in this case ;)
Again, thank you.
Thanks for this thread. Most helpful :-)