I am developing apps in C++ for distribution on different OSs. A lot of them have some xml config files that get read on startup, ie 'my_app_config.cfg'.
In the code, I use Qt's file dialog objects to access the file and I use boost/property_tree/xml_parser.hpp to do the xml parsing. Pretty straight forward stuff, really simple xml files.
On Windows and linux, this works fine, but when I make an app on Mac, it always throws me the 'Cannot read config file:' message that I wrote in my code if the file can't be opened.
What's weird is that this only happens when I call my load_config()
function on startup -- i.e in the canonical Qt constructor, MainWindow::MainWindow(...)
. I can load the config file after startup with my menu item which calls the same load_config()
function.
I thought that maybe I should put the config file in the app's Contents/MacOS folder where the actual binary is, but this doesn't work either (plus I don't want config files invisible to my users).
Things like this keep me awake at night.
No comments:
Post a Comment