1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-13 22:21:11 +02:00

Sweep for filename copying: import and export

This commit is contained in:
Paul Licameli
2016-02-21 23:21:11 -05:00
parent 8f02213e23
commit c3cca71461
6 changed files with 19 additions and 17 deletions

View File

@@ -98,7 +98,7 @@ public:
~ExportFFmpeg() override;
/// Callback, called from GetFilename
bool CheckFileName(wxFileName &filename, int format = 0);
bool CheckFileName(wxFileName &filename, int format = 0) override;
/// Format intialization
bool Init(const char *shortname, AudacityProject *project, const Tags *metadata, int subformat);

View File

@@ -920,24 +920,28 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
}
int ExportMultiple::DoExport(int channels,
wxFileName name,
const wxFileName &inName,
bool selectedOnly,
double t0,
double t1,
const Tags &tags)
{
wxLogDebug(wxT("Doing multiple Export: File name \"%s\""), (name.GetFullName()).c_str());
wxFileName name;
wxLogDebug(wxT("Doing multiple Export: File name \"%s\""), (inName.GetFullName()).c_str());
wxLogDebug(wxT("Channels: %i, Start: %lf, End: %lf "), channels, t0, t1);
if (selectedOnly) wxLogDebug(wxT("Selected Region Only"));
else wxLogDebug(wxT("Whole Project"));
if (mOverwrite->GetValue()) {
// Make sure we don't overwrite (corrupt) alias files
if (!mProject->GetDirManager()->EnsureSafeFilename(name)) {
if (!mProject->GetDirManager()->EnsureSafeFilename(inName)) {
return false;
}
name = inName;
}
else {
name = inName;
int i = 2;
wxString base(name.GetName());
while (name.FileExists()) {
@@ -946,9 +950,10 @@ int ExportMultiple::DoExport(int channels,
}
// Call the format export routine
const wxString fullPath{name.GetFullPath()};
int success = mPlugins[mPluginIndex]->Export(mProject,
channels,
name.GetFullPath(),
fullPath,
selectedOnly,
t0,
t1,
@@ -957,7 +962,7 @@ int ExportMultiple::DoExport(int channels,
mSubFormatIndex);
if (success == eProgressSuccess || success == eProgressStopped) {
mExported.Add(name.GetFullPath());
mExported.Add(fullPath);
}
Refresh();

View File

@@ -74,7 +74,7 @@ private:
* @param tags Metadata to include in the file (if possible).
*/
int DoExport(int channels,
wxFileName name,
const wxFileName &name,
bool selectedOnly,
double t0,
double t1,

View File

@@ -145,7 +145,7 @@ private:
void doScrollOffset();
wxTextFile *mTextFile;
wxFileName *mLOFFileName; /**< The name of the LOF file, which is used to
wxFileName mLOFFileName; /**< The name of the LOF file, which is used to
interpret relative paths in it */
AudacityProject *mProject;
@@ -164,9 +164,9 @@ private:
LOFImportFileHandle::LOFImportFileHandle(const wxString & name, wxTextFile *file)
: ImportFileHandle(name),
mTextFile(file)
, mLOFFileName{name}
{
mProject = GetActiveProject();
mLOFFileName = new wxFileName(name);
windowCalledOnce = false;
callDurationFactor = false;
durationFactor = 1;
@@ -374,7 +374,7 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
// If path is relative, make absolute path from LOF path
if(!wxIsAbsolutePath(targetfile)) {
wxFileName fName(targetfile);
fName.Normalize(wxPATH_NORM_ALL, mLOFFileName->GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR));
fName.Normalize(wxPATH_NORM_ALL, mLOFFileName.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR));
if(fName.FileExists()) {
targetfile = fName.GetFullPath();
}
@@ -507,7 +507,4 @@ LOFImportFileHandle::~LOFImportFileHandle()
mTextFile->Close();
delete mTextFile;
}
if(mLOFFileName) {
delete mLOFFileName;
}
}

View File

@@ -326,9 +326,9 @@ int OggImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTra
&bitstream);
if (bytesRead == OV_HOLE) {
wxFileName f(mFilename);
wxFileName ff(mFilename);
wxLogError(wxT("Ogg Vorbis importer: file %s is malformed, ov_read() reported a hole"),
f.GetFullName().c_str());
ff.GetFullName().c_str());
/* http://lists.xiph.org/pipermail/vorbis-dev/2001-February/003223.html
* is the justification for doing this - best effort for malformed file,
* hence the message.

View File

@@ -135,11 +135,11 @@ public:
// identify the filename being imported.
void CreateProgress()
{
wxFileName f(mFilename);
wxFileName ff(mFilename);
wxString title;
title.Printf(_("Importing %s"), GetFileDescription().c_str());
mProgress.create(title, f.GetFullName());
mProgress.create(title, ff.GetFullName());
}
// This is similar to GetImporterDescription, but if possible the