Add wxLogWarning messages to AudacityProject::OpenFile()
Fixed correction for "A linked track's partner should never itself be linked" to remove the link from the partner, not the original (left).
Fix possible NULL pointer dereference in previous commit.
Modified by mchinen to cleanup debug messages and fix unbalanced mutex on error.
Original patch notes:
OD loader doesn't properly continue scanning files
BUG:
* import large audio file with OD import
* save and close project before OD finishes
* open project again: OD failes badly on continuing
Syntoms:
* .auf.auf.auf worm files ...
* truncated wave display
The isse is subtile:
<odpcmaliasblockfile summaryfile="e000031a.auf" aliasfile="/home/chris/Records/test/0.5seek+cue.flac" aliasstart="26738688" aliaslen="524288" aliaschannel="1"/>
A ODPCMAliasBlockFile is a AliasBlockFile which has 3 overloaded
constructer. One of then silently adds '.aup' to the summaryfile.
So when creating those tracks from XML, we must use the other constructor.
Now we run into a second bug:
AudacityProject::OpenFile calls ProjectFSCK after reading which deletes
the just created empty directories in the _data/e00 dir. OD is doomed.
So simply skip rmdir in fsck. The OD..Blockfiles will disapper when the
OD finishes, so empty dirs will be deleted on further opening the project.
I refactored the code into AudacityApp with a new timer. This is provisional pending discussion - if it is decided that it should go somewhere else I will move it.
Fix auto-recovery failures that Gale reported, when auto-recovered projects had been saved to top-level directories, e.g., "E:\dtmf.aup" on Windows. Problem was with file separators. This DirManager code is quite convoluted, touched by multiple chefs, and called from many places, so this fix does not correct the origination(s) of the problem, but doesn't break anything higher up, and is a failsafe against probably multiple errors at higher levels.
Make some parameter names clearer vs class vars. Readability is better if the names are not lexicographically exactly the same.
Changed the bSilentlyCorrect parameter to DirManager::ProjectFSCK() to be bAutoRecoverMode. If project check errors are found during auto-recovery, it's hazardous to allow the user the various options available during normal project open. But rather than squelching the messages as well as option dialogs during auto-recover, show the messages in the log and bring up an alert.
This means the helper methods Find*() no longer need bSilentlyCorrect -- they always report to the log.
Make DirManager::MoveToNewProjectDirectory(), DirManager::CopyToNewProjectDirectory(), and several BuildFromXML() methods check the result of AssignFile() and do something appropriate about it on failure, rather than ignoring it. Also made AssignFile() check whether the assigned name is well-formed, so it doesn't always return TRUE when disckcheck is FALSE.
Briefer and more correct checks for uninitialized wxFileName objects.
Several "//ANSWER-ME" comments about file ops and commented-out cruft to probably remove.
Clarify some logic and readability.
In light of discussion about crazy things users do, decided to leave in the former "Temporarily replace..." options, but changed the wording to "Treat missing audio as silence" and warn that the waveform may not show silence.
Added FSCKstatus_SAVE_AUP flag (and returned FSCKstatus_* to being flags). FSCKstatus_SAVE_AUP is set for missing aliased files, so that AudacityProject does a save, fixing a bug where after "Close project immediately...", opening other projects failed in a way that made them incorrectly report missing _data folders, rather than go through Project Check (DirManager::ProjectFSCK).
Decided to continue with the fake-out fixes for missing aliased files and missing SimpleBlockFiles, i.e., writing zeroes instead of replacing with SilentBlockFiles. Replacing is difficult, and there are other places where the zeroes trick is used, e.g., after project check, if there's a disk error, such as a .au being inaccessible in the middle of edits.
Made the "permanent immediately" and "regenerate" options not do a PushState, because they were not possible to Undo.
DirManager::ProjectFSCK (project check):
Made the enumerations interleaved with handling, because,
for example, user choosing to replace missing aliased block files with silence
needs to put in SilentBlockFiles and delete the corresponding auf files,
so those would then not be cumulated in missingAliasBlockFileHash.
We still do the FindX methods outside the conditionals,
so the log always shows all found errors.
Moved check for orphan files to last, so user first has a chance to get
messages about missing files that user may have mistakenly renamed
(and the renamed ones would appear to be orphans).
Re-ordered user choices for orphan files dialog to safest-to-boldest.
Changed FSCKstatus_CLOSEREQ and FSCKstatus_CHANGED to be integers rather
than binary flags. They were never returned with both in the result, nor used that way.
Made the project check log warnings use full paths instead of just file names.
Removed close box and system menu from MultiDialog, so that project check dialogs cannot just be closed. User has to decide on one of the choices.
Fixed some handling in AudacityProject::OnShowLog(). If the log was already showing before MultiDialog came up, it froze because it was not re-enabled.
More comments about things to fix (FIX-ME items this time).
Made AudacityProject::OnShowLog make the log window taller so more likely to show the bottom. The implementation of wxLogWindow makes it hard/impossible to scroll to the bottom.
Fix error of duplicate reports of missing aliased files.
restructuring and renaming for clarity, granularity, and reduction of code duplication
Found and commented on more errors in this code. In the "Close immediately" cases, it doesn't do a real close and that can break subsequent opening of other or the same problematic projects.
Changed several cases where GetDirManager()->ProjectFSCK returned FSCKstatus_CHANGED. These caused a PushState, but Undo could not do anything. Changed corresponding wordings for "Replace missing audio with silence" to say "permanent immediately" instead of "permanent on save", which was incorrect.
Added a "Show Log for Details" button to MultiDialog so it does what the comments say, i.e., allows the user to look in the log to see which files are problematic (e.g., orphaned blockfiles.
Tightened up ProjectFSCK messages.
Added comments about remaining (long-standing!) problems in ProjectFSCK.
Comments about what's wrong with the DirManager::ProjectFSCK "Missing Aliased Files" dialog actions and what to do about it. (More to follow!)
Changed PushState for project repair from "Repair" to "Project Repair" to distinguish from Repair effect.
renames for clarity
better handling of error conditions in PCMAliasBlockFile::BuildFromXML so that DirManager::ProjectFSCK can report cases of missing PCMAliasBlockFile files on opening projects where missing files were not corrected
code cleanup
naming improvements for clarity (e.g., aliasedFileName instead of aliasedFile for an instance of wxFileName -- it's not an instance of AliasedFile)
parens, not square brackets, for parenthetic phrases
* Make progress messages not have ellipsis at end, as convention in other cases.
* Reword "Continue without deleting" radio button about orphan files.
* Fix the removal of empty dirs at the end of DirManager::ProjectFSCK() which previously did nothing because it passed a hardcoded zero count for the file list, to what is now RecursivelyRemove(). Added RecursivelyCountSubdirs() so progress dialog has correct maximum (directory count, not blockCount as previously). Added RecursivelyRemoveEmptyDirs().
* Found that Windows SDK functions sometimes do not remove empty directories and added code to help it in some cases.