Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The configuration file name has has the executable name
- // but with the ".config" extension.
- //
- wxFileName configFileName(wxStandardPaths::Get().GetExecutablePath());
- configFileName.SetExt("config");
- // The config object uses the above file name, and captures the defaults.
- //
- wxFileConfig * pConfig = new wxFileConfig(wxEmptyString,
- wxEmptyString,
- wxEmptyString,
- configFileName.GetFullPath(),
- wxCONFIG_USE_GLOBAL_FILE);
- pConfig->SetRecordDefaults(); // to capture the defaults
- wxFileConfig::Set(pConfig); // to be globally accessible
- // One of the configuration values is the file name for the exported
- // values (the app.exe functionality, unrelated to the config file name).
- // It uses a subdirectory with the name built out of the exe path, its name
- // without the extension, with the "_OUTPUT" appended.
- // For example, "some/path/App.exe" should produce "some/path/App_OUTPUT".
- // The file name is again constructed from the bare app name with
- // the ".txt" extension.
- //
- wxFileName outfname(configFileName.GetPath()); // same as the exe path
- outfname.AppendDir(configFileName.GetName() + "_OUTPUT"); // the subdir
- outfname.SetName(configFileName.GetName()); // same name as app has
- outfname.SetExt("txt"); // with the .txt extension
- outfname.Normalize(); // actually, my real path contains also ".."
- // The above constructed filename is the default for the "output" key.
- // I expect to be recorded into the pConfig because of the above
- // pConfig->SetRecordDefaults(); Is my expectation correct?
- //
- m_output_filename = pConfig->Read("output", outfname.GetFullPath());
- if (! configFileName.Exists())
- {
- pConfig->??? What should be called?
- }
- if ( !IsDirty() || !m_fnLocalFile.GetFullPath() )
- return true;
- wxFileConfig * pConfig = new wxFileConfig(wxEmptyString,
- wxEmptyString,
- configFileName.GetFullPath(),
- wxEmptyString,
- wxCONFIG_USE_LOCAL_FILE);
Add Comment
Please, Sign In to add comment