1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-04-03 04:47:37 +02:00

Move AbbreviatePath to FileNames

This commit is contained in:
Paul Licameli
2020-12-06 14:53:35 -05:00
parent f07fd5d8bc
commit 4e260389da
6 changed files with 31 additions and 28 deletions

View File

@@ -846,7 +846,7 @@ bool FileNames::IsOnFATFileSystem(const FilePath &path)
wxFileNameWrapper fileName{path};
if (!fileName.HasVolume())
return false;
auto volume = fileName.GetVolume() + wxT(":\\");
auto volume = AbbreviatePath(fileName) + wxT("\\");
DWORD volumeFlags;
wxChar volumeType[64];
if (!::GetVolumeInformationW(
@@ -864,3 +864,23 @@ bool FileNames::IsOnFATFileSystem(const FilePath &path)
}
#endif
wxString FileNames::AbbreviatePath( const wxFileName &fileName )
{
wxString target;
#ifdef __WXMSW__
// Drive letter plus colon
target = fileName.GetVolume() + wxT(":");
#else
// Shorten the path, arbitrarily to 3 components
auto path = fileName;
path.SetFullName(wxString{});
while(path.GetDirCount() > 3)
path.RemoveLastDir();
target = path.GetFullPath();
#endif
return target;
}