1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-29 01:25:53 +01:00

Use type aliases FilePath, FilePaths...

... 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)
This commit is contained in:
Paul Licameli
2019-03-07 14:50:22 -05:00
parent 485b6bb425
commit a30000cf74
80 changed files with 371 additions and 342 deletions

View File

@@ -59,7 +59,7 @@ bool XMLValueChecker::IsGoodLongString(const wxString & str)
// "Good" means the name is well-formed and names an existing file or folder.
bool XMLValueChecker::IsGoodFileName(const wxString & strFileName, const wxString & strDirName /* = {} */)
bool XMLValueChecker::IsGoodFileName(const FilePath & strFileName, const FilePath & strDirName /* = "{} */)
{
// Test strFileName.
if (!IsGoodFileString(strFileName) ||
@@ -71,7 +71,7 @@ bool XMLValueChecker::IsGoodFileName(const wxString & strFileName, const wxStrin
return (fileName.IsOk() && fileName.FileExists());
}
bool XMLValueChecker::IsGoodFileString(const wxString &str)
bool XMLValueChecker::IsGoodFileString(const FilePath &str)
{
return (IsGoodString(str) &&
!str.empty() &&
@@ -83,7 +83,7 @@ bool XMLValueChecker::IsGoodFileString(const wxString &str)
(str.Find(wxFileName::GetPathSeparator()) == -1)); // No path separator characters.
}
bool XMLValueChecker::IsGoodSubdirName(const wxString & strSubdirName, const wxString & strDirName /* = {} */)
bool XMLValueChecker::IsGoodSubdirName(const FilePath & strSubdirName, const FilePath & strDirName /* = {} */)
{
// Test strSubdirName.
// Note this prevents path separators, and relative path to parents (strDirName),
@@ -99,14 +99,14 @@ bool XMLValueChecker::IsGoodSubdirName(const wxString & strSubdirName, const wxS
return (fileName.IsOk() && fileName.DirExists());
}
bool XMLValueChecker::IsGoodPathName(const wxString & strPathName)
bool XMLValueChecker::IsGoodPathName(const FilePath & strPathName)
{
// Test the corresponding wxFileName.
wxFileName fileName(strPathName);
return XMLValueChecker::IsGoodFileName(fileName.GetFullName(), fileName.GetPath(wxPATH_GET_VOLUME));
}
bool XMLValueChecker::IsGoodPathString(const wxString &str)
bool XMLValueChecker::IsGoodPathString(const FilePath &str)
{
return (IsGoodString(str) &&
!str.empty() &&