mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-26 09:08:44 +02:00
Commit mildy modified version of a patch by Joseph Gay to handle and convert relative paths in LOF files (i.e. relative to path of LOF file)
This commit is contained in:
parent
b0e23dbaf7
commit
bd192bfa2b
@ -138,6 +138,8 @@ private:
|
||||
void doScrollOffset();
|
||||
|
||||
wxTextFile *mTextFile;
|
||||
wxFileName *mLOFFileName; /**< The name of the LOF file, which is used to
|
||||
interpret relative paths in it */
|
||||
AudacityProject *mProject;
|
||||
|
||||
// In order to know whether or not to create a new window
|
||||
@ -157,6 +159,7 @@ LOFImportFileHandle::LOFImportFileHandle(const wxString & name, wxTextFile *file
|
||||
mTextFile(file)
|
||||
{
|
||||
mProject = GetActiveProject();
|
||||
mLOFFileName = new wxFileName(name);
|
||||
windowCalledOnce = false;
|
||||
callDurationFactor = false;
|
||||
durationFactor = 1;
|
||||
@ -359,6 +362,15 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
|
||||
tokenholder = temptok1.GetNextToken();
|
||||
targetfile = temptok1.GetNextToken();
|
||||
|
||||
// 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));
|
||||
if(fName.FileExists()) {
|
||||
targetfile = fName.GetFullPath();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_MIDI
|
||||
// If file is a midi
|
||||
if (targetfile.AfterLast(wxT('.')).IsSameAs(wxT("mid"), false)
|
||||
@ -492,6 +504,9 @@ LOFImportFileHandle::~LOFImportFileHandle()
|
||||
mTextFile->Close();
|
||||
delete mTextFile;
|
||||
}
|
||||
if(mLOFFileName) {
|
||||
delete mLOFFileName;
|
||||
}
|
||||
}
|
||||
|
||||
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
|
||||
|
Loading…
x
Reference in New Issue
Block a user