... for wxString and wxArrayStringEx, holding file paths (absolute or relative,
directory or plain file); to be replaced later with different types
(not yet using std::vector, becase of some uses of wxArrayString::Index with
two arguments)
... Replacing:
Insert => insert
RemoveAt => erase
Remove => erase
IsSameAs => operator == or operator !=
(but only when second argument was true or default)
... instead use the utility make_iterator_range and its index() or contains()
method. This generic utility works with any container defining begin() and
end().
This further lessens dependency on wxWidgets container idioms.
... which will make it easier to change the types of those containers to
std::vectors of other string-like classes
for wxString,
IsEmpty => empty
Clear => clear
Alloc => reserve
for wxArrayString,
Count => size
GetCount => size
IsEmpty => empty
Add => push_back
Clear => clear
Empty => clear
Sort => std::sort (only with default comparator)
SetCount => resize
Last => back
Item => operator []
Alloc => reserve
... and similar wx "variadics," which all treat wxString smartly enough that
you don't need this.
Don't need c_str either to convert wxString to const wxChar * because
wxString has a conversion operator that does the same.
- Dead code from experiments in SelectionBar removed.
- Many warnings about unused parameters fixed with WXUNUSED()
- Many warnings about signed / unsigned comparisons cleaned up.
- Several 'local variable declared but not used' warnings fixed.
... Do NOT remove original files, or change the stored path names, until after
successful creation of ALL new copies; then, it is a no-throw commit operation.
In case of failure of some copies, cleanup code already existed to fix
partial results.
This fix adds flags to RecursivelyRemove to be more specific about what to remove. With the kCleanDirsOnlyIfEmpty option it is now safe to call CleanDir on closing a second unsaved project. In particular, if some of the wave has been copied to the clipboard, that part of the wave does not get deleted on close, and is available to paste into the other project which is still open. In CleanDir the folders containing those block files are not deleted. They will get deleted later when the second project is closed too.
CleanDir is now called with that option when closing a project that is not the last one being closed. .DS_Store files, if present, will be deleted, and any empty directories for that project. I have also tested that clipboard contents are preserved.
Note that CleanDir may be used on a temp directory, deleting entire projects, and in that case
we delete all files too, but do not want to delete files that are at the top level, only ones inside
projects.
Projects will only have symlinks in them if they have been tampered with, and then
following the links, especially when doing CleanDir(), would be dangerous. So don't.
Improved comments, otherwise it isn't clear that CleanDir is needed on Windows
and Linux, not just Mac. It is deleting whole subdirs, not just .DS_Store files.
Added for consistency with log of remaining files. This change should clear up .DS_Store on Mac, and so help with 1567 residual issue when files are not deleted on exit.
... whenever they really describe the size of a buffer that fits in memory, or
of a block file (which is never now more than a megabyte and so could be fit in
memory all at once), or a part thereof.