Save curves to external file
| 280 | // Save curves to external file |
| 281 | // |
| 282 | void EQCurveWriter::SaveCurves(const wxString &fileName) |
| 283 | { |
| 284 | wxFileName fn; |
| 285 | if( fileName.empty() ) |
| 286 | { |
| 287 | // Construct default curve filename |
| 288 | // |
| 289 | // LLL: Wouldn't you know that as of WX 2.6.2, there is a conflict |
| 290 | // between wxStandardPaths and wxConfig under Linux. The latter |
| 291 | // creates a normal file as "$HOME/.audacity", while the former |
| 292 | // expects the ".audacity" portion to be a directory. |
| 293 | fn = wxFileName( FileNames::DataDir(), wxT("EQCurves.xml") ); |
| 294 | |
| 295 | // If the directory doesn't exist... |
| 296 | if( !fn.DirExists() ) |
| 297 | { |
| 298 | // Attempt to create it |
| 299 | if( !fn.Mkdir( fn.GetPath(), 511, wxPATH_MKDIR_FULL ) ) |
| 300 | { |
| 301 | // MkDir() will emit message |
| 302 | return; |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | else |
| 307 | fn = fileName; |
| 308 | |
| 309 | GuardedCall( [&] { |
| 310 | // Create/Open the file |
| 311 | const wxString fullPath{ fn.GetFullPath() }; |
| 312 | XMLFileWriter eqFile{ fullPath, XO("Error Saving Equalization Curves") }; |
| 313 | |
| 314 | // Write the curves |
| 315 | WriteXML( eqFile ); |
| 316 | |
| 317 | eqFile.Commit(); |
| 318 | } ); |
| 319 | } |
| 320 | |
| 321 | // |
| 322 | // Process XML tags and handle the ones we recognize |
no test coverage detected