MCPcopy Create free account
hub / github.com/audacity/audacity / ProjectFSCK

Function ProjectFSCK

src/ProjectFSCK.cpp:32–409  ·  view source on GitHub ↗

Check the BlockFiles against the disk state. Missing Blockfile data can be regenerated if possible or replaced with silence. Orphan blockfiles can be deleted. Note that even BlockFiles not referenced by the current savefile (but locked by history) will be reflected in the mBlockFileHash, and that's a good thing; this is one reason why we use the hash and not the most recent savefile.

Source from the content-addressed store, hash-verified

30// good thing; this is one reason why we use the hash and not the most
31// recent savefile.
32int ProjectFSCK(
33 DirManager &dm, const bool bForceError, const bool bAutoRecoverMode)
34{
35#pragma message( "====================================================================")
36#pragma message( "Don\'t forget to redo ProjectFSCK")
37#pragma message( "====================================================================")
38 // In earlier versions of this method, enumerations of errors were
39 // all done in sequence, then the user was prompted for each type of error.
40 // The enumerations are now interleaved with prompting, because, for example,
41 // user choosing to replace missing aliased block files with silence
42 // needs to put in SilentBlockFiles and DELETE the corresponding auf files,
43 // so those would then not be cumulated in missingAUFHash.
44 // We still do the FindX methods outside the conditionals,
45 // so the log always shows all found errors.
46
47 int action; // choice of action for each type of error
48 int nResult = 0;
49
50 if (bForceError && !bAutoRecoverMode)
51 {
52 // TODO: Replace with more user friendly error message?
53 /* i18n-hint: The audacity project file is XML and has 'tags' in it,
54 rather like html tags <something>some stuff</something>.
55 This error message is about the tags that hold the sequence information.
56 The error message is confusing to users in English, and could just say
57 "Found problems with <sequence> when checking project file." */
58 auto msg = XO("Project check read faulty Sequence tags.");
59 const TranslatableStrings buttons{
60 XO("Close project immediately with no changes"),
61 XO("Continue with repairs noted in log, and check for more errors. This will save the project in its current state, unless you \"Close project immediately\" on further error alerts.")
62 };
63 wxLog::FlushActive(); // MultiDialog has "Show Log..." button, so make sure log is current.
64 action = ShowMultiDialog(msg,
65 XO("Warning - Problems Reading Sequence Tags"),
66 buttons,"");
67 if (action == 0)
68 nResult = FSCKstatus_CLOSE_REQ;
69 else
70 nResult = FSCKstatus_CHANGED | FSCKstatus_SAVE_AUP;
71 }
72#if 0
73 FilePaths filePathArray; // *all* files in the project directory/subdirectories
74 auto dirPath = ( dm.GetDataFilesDir() );
75 DirManager::RecursivelyEnumerateWithProgress(
76 dirPath,
77 filePathArray, // output: all files in project directory tree
78 wxEmptyString, // All dirs
79 wxEmptyString, // All files
80 true, false,
81 dm.NumBlockFiles(), // rough guess of how many BlockFiles will be found/processed, for progress
82 XO("Inspecting project file data"));
83
84 //
85 // MISSING ALIASED AUDIO FILES
86 //
87 MissingAliasFilesDialog::SetShouldShow(false);
88 BlockHash missingAliasFilesAUFHash; // (.auf) AliasBlockFiles whose aliased files are missing
89 BlockHash missingAliasFilesPathHash; // full paths of missing aliased files

Callers

nothing calls this directly

Calls 11

moveFunction · 0.85
GuardedCallFunction · 0.85
AudacityMessageBoxFunction · 0.85
GetProjectNameMethod · 0.80
ShowMultiDialogFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
lockMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected