CString CPathFinder::GetDriveLabel(BOOL bPCNameIfNetwork) { if (_sDriveLabel.IsEmpty() && !IsRelativePath()) { if ((bPCNameIfNetwork) && (!IsLocalPath())) _sDriveLabel = GetDir(0); else { CString sRoot; TCHAR szVolumeName[256]; szVolumeName[0] = '\0'; if (IsLocalPath()) { sRoot = _sDrive + CString(_T("\\")); } else if (GetDirCount() > 1) { sRoot.Format(_T("\\\\%s\\%s\\"), GetDir(0), GetDir(1)); } GetVolumeInformation(sRoot, szVolumeName, 255, NULL, NULL, NULL, NULL, 0); _sDriveLabel = szVolumeName; } } return _sDriveLabel; }
/*--------------------------------------------------------------------------------------------- Name : GetDir(int nIndex = -1) Purpose : Get 0 based nIndex folder string Parameters : int nIndex - If nIndex = -1 the return string is the full dir string [e.g.: "\folder\subfolder\" or "\\pcname\folder\" for non-local] Return : CString - Directory Globals Modified : None. --------------------------------------------------------------------------------------------*/ CString CPath::GetDir(int nIndex) { if (nIndex < 0) return _strDir; else if (nIndex < GetDirCount()) { FillDirArray(); return _arrDir[nIndex]; } return sCEmptyString; }
CString CPathFinder::GetDir(int nIndex) { if (nIndex < 0) return _sDir; else if (nIndex < GetDirCount()) { FillDirArray(); return _aDir[nIndex]; } return (LPCTSTR)sCEmptyString; }
wxString FileException::ErrorMessage() const { wxString format; switch (cause) { case Cause::Open: format = _("Audacity failed to open a file in %s."); break; case Cause::Read: format = _("Audacity failed to read from a file in %s."); break; case Cause::Write: format = _("Audacity failed to write to a file.\n" "Perhaps %s is not writable or the disk is full."); break; case Cause::Rename: format = _("Audacity successfully wrote a file in %s but failed to rename it as %s."); default: break; } 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 wxString::Format( format, target, renameTarget.GetFullName() ); }