Example #1
0
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;
}
Example #2
0
/*---------------------------------------------------------------------------------------------
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;
}
Example #3
0
CString CPathFinder::GetDir(int nIndex)
{
	if (nIndex < 0)
		return _sDir;
	else if (nIndex < GetDirCount())
	{
		FillDirArray();
		return _aDir[nIndex];
	}

	return (LPCTSTR)sCEmptyString;
}
Example #4
0
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() );
}