Example #1
0
void Pathname::SetDrive(const char dr)
{
  if (HasDrive())
  {
    if (dr == 0)
    {
      strcpy(_path,_path+2);
      strcpy(_fullpath,_fullpath+2);
    }
    else
    {
      _path[0] = dr;
      _fullpath[0] = dr;
    }
  }
  else if (dr != 0)
  {        
    int np = IsNetworkPath();
    if (np)
    {
      _path[0] = dr;
      _path[1] =':';
      strcpy(_path+2,_path+np);
      RebuildPath();
    }
    else
    {
      char *c = (char *)alloca((strlen(_path)+4)*sizeof(*c));          
      sprintf(c,"%c:%s",dr,_path);
      SetDirectory(c);
    }
  }
}
Example #2
0
void Pathname::SetServerName(const char *server)
{
  if (HasDrive()) SetDrive(0);
  else
  {
    int np = IsNetworkPath();
    if (np) strcpy(_path,_path+np); //str
  }
  char *buff = (char *)alloca((strlen(server)+strlen(_path)+5)*sizeof(*buff));
  if (_path[0]!='\\')
    sprintf(buff,"\\\\%s\\%s",server,_path);
  else
    sprintf(buff,"\\\\%s%s",server,_path);
  SetDirectory(buff);
}
Example #3
0
void NormalizeSymlinkName(string &strLinkName)
{
	if (!StrCmpN(strLinkName,L"\\??\\",4))
	{
		if (IsNetworkPath(strLinkName) || IsLocalVolumePath(strLinkName))
		{
			LPWSTR LinkName=strLinkName.GetBuffer();
			LinkName[1]=L'\\';
			strLinkName.ReleaseBuffer();
		}
		else
		{
			strLinkName.LShift(4);
		}
	}
}