diff options
author | Sakari Bergen <sakari.bergen@beatwaves.net> | 2012-01-22 18:02:27 +0000 |
---|---|---|
committer | Sakari Bergen <sakari.bergen@beatwaves.net> | 2012-01-22 18:02:27 +0000 |
commit | 09d1fbd6c141b0d209b425df9488f4f0400d72c3 (patch) | |
tree | df575f96b54963737e078b3e6495c07e08d1a5fd /libs/ardour/export_handler.cc | |
parent | e317386c5cde5741a8279bf480240293720d6788 (diff) |
Add warnings for overwriting marker files
git-svn-id: svn://localhost/ardour2/branches/3.0@11305 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/export_handler.cc')
-rw-r--r-- | libs/ardour/export_handler.cc | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index b789304bdc..c864cf4bf7 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -266,12 +266,7 @@ void ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSpecPtr file_format, std::string filename, CDMarkerFormat format) { - string filepath; - - /* do not strip file suffix because there may be more than one format, - and we do not want the CD marker file from one format to overwrite - another (e.g. foo.wav.cue > foo.aiff.cue) - */ + string filepath = get_cd_marker_filename(filename, format); void (ExportHandler::*header_func) (CDMarkerStatus &); void (ExportHandler::*track_func) (CDMarkerStatus &); @@ -279,15 +274,11 @@ ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSp switch (format) { case CDMarkerTOC: - filepath = filename; - filepath += ".toc"; header_func = &ExportHandler::write_toc_header; track_func = &ExportHandler::write_track_info_toc; index_func = &ExportHandler::write_index_info_toc; break; case CDMarkerCUE: - filepath = filename; - filepath += ".cue"; header_func = &ExportHandler::write_cue_header; track_func = &ExportHandler::write_track_info_cue; index_func = &ExportHandler::write_index_info_cue; @@ -381,6 +372,24 @@ ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSp } } +string +ExportHandler::get_cd_marker_filename(std::string filename, CDMarkerFormat format) +{ + /* do not strip file suffix because there may be more than one format, + and we do not want the CD marker file from one format to overwrite + another (e.g. foo.wav.cue > foo.aiff.cue) + */ + + switch (format) { + case CDMarkerTOC: + return filename + ".toc"; + case CDMarkerCUE: + return filename + ".cue"; + default: + return filename + ".marker"; // Should not be reached when actually creating a file + } +} + void ExportHandler::write_cue_header (CDMarkerStatus & status) { |