本文整理汇总了C++中PointToName函数的典型用法代码示例。如果您正苦于以下问题:C++ PointToName函数的具体用法?C++ PointToName怎么用?C++ PointToName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PointToName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFilePath
// Returns file path including the trailing path separator symbol.
void GetFilePath(const wchar *FullName,wchar *Path,size_t MaxLength)
{
if (MaxLength==0)
return;
size_t PathLength=Min(MaxLength-1,size_t(PointToName(FullName)-FullName));
wcsncpy(Path,FullName,PathLength);
Path[PathLength]=0;
}
示例2: return
bool ScanTree::PrepareMasks()
{
if (!FileMasks->GetString(CurMask,CurMaskW,sizeof(CurMask)))
return(false);
#ifdef _WIN_32
UnixSlashToDos(CurMask);
#endif
char *Name=PointToName(CurMask);
if (*Name==0)
strcat(CurMask,MASKALL);
if (Name[0]=='.' && (Name[1]==0 || Name[1]=='.' && Name[2]==0))
{
AddEndSlash(CurMask);
strcat(CurMask,MASKALL);
}
SpecPathLength=Name-CurMask;
// if (SpecPathLength>1)
// SpecPathLength--;
bool WideName=(*CurMaskW!=0);
if (WideName)
{
wchar *NameW=PointToName(CurMaskW);
if (*NameW==0)
strcatw(CurMaskW,MASKALLW);
if (NameW[0]=='.' && (NameW[1]==0 || NameW[1]=='.' && NameW[2]==0))
{
AddEndSlash(CurMaskW);
strcatw(CurMaskW,MASKALLW);
}
SpecPathLengthW=NameW-CurMaskW;
}
else
{
wchar WideMask[NM];
CharToWide(CurMask,WideMask);
SpecPathLengthW=PointToName(WideMask)-WideMask;
}
Depth=0;
strcpy(OrigCurMask,CurMask);
strcpyw(OrigCurMaskW,CurMaskW);
return(true);
}
示例3: PointToExt
// Возвращает ".ext" или NULL в случае ошибки
const wchar_t* PointToExt(const wchar_t* asFullPath)
{
const wchar_t* pszName = PointToName(asFullPath);
if (!pszName)
return NULL; // _ASSERTE уже был
const wchar_t* pszExt = wcsrchr(pszName, L'.');
return pszExt;
}
示例4: DownloadFile
UINT DownloadFile(LPCWSTR asSource, LPCWSTR asTarget, DWORD& crc, DWORD& size, BOOL abShowAllErrors = FALSE)
{
UINT iRc = E_UNEXPECTED;
UINT nWait;
wchar_t* pszCommand = NULL;
wchar_t* szCmdDirectory = NULL; // Destination directory for file creation
MCHKHEAP;
// Split target into directory and file-name
LPCWSTR pszName = PointToName(asTarget);
if (pszName > asTarget)
{
szCmdDirectory = lstrdup(asTarget);
if (!szCmdDirectory)
{
iRc = E_OUTOFMEMORY;
goto wrap;
}
szCmdDirectory[pszName-asTarget] = 0;
}
// Prepare command line for downloader tool
pszCommand = CreateCommand(asSource, pszName, iRc);
if (!pszCommand)
{
_ASSERTE(iRc!=0);
goto wrap;
}
_ASSERTE(m_PI.hProcess==NULL);
MCHKHEAP;
nWait = ExecuteDownloader(pszCommand, szCmdDirectory);
// Now check the result of downloader proc
if (nWait != 0)
{
iRc = nWait;
goto wrap;
}
if (!CalcFileHash(asTarget, size, crc))
{
iRc = GetLastError();
if (!iRc)
iRc = E_UNEXPECTED;
goto wrap;
}
iRc = 0; // OK
wrap:
MCHKHEAP;
SafeFree(pszCommand);
SafeFree(szCmdDirectory);
CloseHandles();
return iRc;
};
示例5: lsLogPath
void CSetPgFeatures::UpdateLogLocation()
{
// Cut log file to directory only
CEStr lsLogPath(gpSet->GetLogFileName());
LPCWSTR pszName = lsLogPath.IsEmpty() ? NULL : PointToName(lsLogPath.ms_Val);
if (pszName)
*(wchar_t*)pszName = 0;
SetDlgItemText(gpSetCls->GetPage(thi_Features), tDebugLogDir, lsLogPath);
}
示例6: CmpName
// IS: функция для внешнего мира, использовать ее
int CmpName(const wchar_t *pattern,const wchar_t *str, bool skippath, bool CmpNameSearchMode)
{
if (!pattern || !str)
return FALSE;
if (skippath)
str=PointToName(str);
return CmpName_Body(pattern,str,CmpNameSearchMode);
}
示例7: uiAskReplaceEx
// Additionally to handling user input, it analyzes and sets command options.
// Returns only 'replace', 'skip' and 'cancel' codes.
UIASKREP_RESULT uiAskReplaceEx(RAROptions *Cmd,wchar *Name,size_t MaxNameSize,int64 FileSize,RarTime *FileTime,uint Flags)
{
if (Cmd->Overwrite==OVERWRITE_NONE)
return UIASKREP_R_SKIP;
#if !defined(SFX_MODULE) && !defined(SILENT)
// Must be before Cmd->AllYes check or -y switch would override -or.
if (Cmd->Overwrite==OVERWRITE_AUTORENAME && GetAutoRenamedName(Name,MaxNameSize))
return UIASKREP_R_REPLACE;
#endif
// This check must be after OVERWRITE_AUTORENAME processing or -y switch
// would override -or.
if (Cmd->AllYes || Cmd->Overwrite==OVERWRITE_ALL)
{
PrepareToDelete(Name);
return UIASKREP_R_REPLACE;
}
wchar NewName[NM];
wcsncpyz(NewName,Name,ASIZE(NewName));
UIASKREP_RESULT Choice=uiAskReplace(NewName,ASIZE(NewName),FileSize,FileTime,Flags);
if (Choice==UIASKREP_R_REPLACE || Choice==UIASKREP_R_REPLACEALL)
PrepareToDelete(Name);
if (Choice==UIASKREP_R_REPLACEALL)
{
Cmd->Overwrite=OVERWRITE_ALL;
return UIASKREP_R_REPLACE;
}
if (Choice==UIASKREP_R_SKIPALL)
{
Cmd->Overwrite=OVERWRITE_NONE;
return UIASKREP_R_SKIP;
}
if (Choice==UIASKREP_R_RENAME)
{
if (PointToName(NewName)==NewName)
SetName(Name,NewName,MaxNameSize);
else
wcsncpyz(Name,NewName,MaxNameSize);
if (FileExist(Name))
return uiAskReplaceEx(Cmd,Name,MaxNameSize,FileSize,FileTime,Flags);
return UIASKREP_R_REPLACE;
}
#if !defined(SFX_MODULE) && !defined(SILENT)
if (Choice==UIASKREP_R_RENAMEAUTO && GetAutoRenamedName(Name,MaxNameSize))
{
Cmd->Overwrite=OVERWRITE_AUTORENAME;
return UIASKREP_R_REPLACE;
}
#endif
return Choice;
}
示例8: RemoveOldComSpecC
void RemoveOldComSpecC()
{
wchar_t szComSpec[MAX_PATH], szComSpecC[MAX_PATH], szRealComSpec[MAX_PATH];
//110202 - comspec более не переопределяется, поэтому вернем "cmd",
// если был переопреден и унаследован от старой версии conemu
if (GetEnvironmentVariable(L"ComSpecC", szComSpecC, countof(szComSpecC)) && szComSpecC[0] != 0)
{
szRealComSpec[0] = 0;
if (!GetEnvironmentVariable(L"ComSpec", szComSpec, countof(szComSpec)))
szComSpec[0] = 0;
#ifndef __GNUC__
#pragma warning( push )
#pragma warning(disable : 6400)
#endif
LPCWSTR pwszName = PointToName(szComSpec);
if (lstrcmpiW(pwszName, L"ConEmuC.exe")==0 || lstrcmpiW(pwszName, L"ConEmuC64.exe")==0)
{
pwszName = PointToName(szComSpecC);
if (lstrcmpiW(pwszName, L"ConEmuC.exe")!=0 && lstrcmpiW(pwszName, L"ConEmuC64.exe")!=0)
{
wcscpy_c(szRealComSpec, szComSpecC);
}
}
#ifndef __GNUC__
#pragma warning( pop )
#endif
if (szRealComSpec[0] == 0)
{
//\system32\cmd.exe
GetComspecFromEnvVar(szRealComSpec, countof(szRealComSpec));
}
SetEnvironmentVariable(L"ComSpec", szRealComSpec);
SetEnvironmentVariable(L"ComSpecC", NULL);
}
}
示例9: CDefTermBase
CDefTermHk::CDefTermHk()
: CDefTermBase(false)
{
mh_StopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
wchar_t szSelfName[MAX_PATH+1] = L"";
GetModuleFileName(NULL, szSelfName, countof(szSelfName));
lstrcpyn(ms_ExeName, PointToName(szSelfName), countof(ms_ExeName));
mn_LastCheck = 0;
ReloadSettings();
}
示例10: IsFarExe
bool IsFarExe(LPCWSTR asModuleName)
{
if (asModuleName && *asModuleName)
{
LPCWSTR pszName = PointToName(asModuleName);
if (lstrcmpi(pszName, L"far.exe") == 0 || lstrcmpi(pszName, L"far") == 0
|| lstrcmpi(pszName, L"far64.exe") == 0 || lstrcmpi(pszName, L"far64") == 0)
{
return true;
}
}
return false;
}
示例11: UpdateExistingShortName
bool UpdateExistingShortName(char *Name,wchar *NameW)
{
FindData fd;
if (!FindFile::FastFind(Name,NameW,&fd))
return(false);
if (*fd.Name==0 || *fd.ShortName==0)
return(false);
if (stricomp(PointToName(fd.Name),fd.ShortName)==0 ||
stricomp(PointToName(Name),fd.ShortName)!=0)
return(false);
char NewName[NM];
for (int I=0;I<10000;I+=123)
{
strncpyz(NewName,Name,ASIZE(NewName));
sprintf(PointToName(NewName),"rtmp%d",I);
if (!FileExist(NewName))
break;
}
if (FileExist(NewName))
return(false);
char FullName[NM];
strncpyz(FullName,Name,ASIZE(FullName));
strcpy(PointToName(FullName),PointToName(fd.Name));
if (!MoveFile(FullName,NewName))
return(false);
File KeepShortFile;
bool Created=false;
if (!FileExist(Name))
Created=KeepShortFile.Create(Name);
MoveFile(NewName,FullName);
if (Created)
{
KeepShortFile.Close();
KeepShortFile.Delete();
}
return(true);
}
示例12: MakeNameUsable
void MakeNameUsable(char *Name, bool bKeepExtension, bool IsFATX)
{
// Changed to be compatible with xbmc's MakeLegalFileName function
// (xbox only)
if ( Name == NULL) return;
char cIllegalChars[] = "<>=?;\"*+,/|";
unsigned int iIllegalCharSize = strlen(cIllegalChars);
bool isIllegalChar;
unsigned int iSize = strlen(Name);
unsigned int iNewStringSize = 0;
char* strNewString = new char[iSize + 1];
// only copy the legal characters to the new filename
for (unsigned int i = 0; i < iSize; i++)
{
isIllegalChar = false;
// check for illigal chars
for (unsigned j = 0; j < iIllegalCharSize; j++)
if (Name[i] == cIllegalChars[j]) isIllegalChar = true;
// FATX only allows chars from 32 till 127
if (isIllegalChar == false &&
Name[i] > 31 && Name[i] < 127) strNewString[iNewStringSize++] = Name[i];
}
strNewString[iNewStringSize] = '\0';
if (IsFATX)
{
// since we can only write to samba shares and hd, we assume this has to be a fatx filename
// thus we have to strip it down to 42 chars (samba doesn't have this limitation)
char* FileName = PointToName(strNewString);
int iFileNameSize = strlen(FileName);
// no need to keep the extension, just strip it down to 42 characters
if (iFileNameSize > 42 && bKeepExtension == false) FileName[42] = '\0';
// we want to keep the extension
else if (iFileNameSize > 42 && bKeepExtension == true)
{
char strExtension[42];
unsigned int iExtensionLength = iFileNameSize - (strrchr(FileName, '.') - FileName);
strcpy(strExtension, (FileName + iFileNameSize - iExtensionLength));
strcpy(FileName + (42 - iExtensionLength), strExtension);
}
}
strcpy(Name, strNewString);
delete[] strNewString;
}
示例13: CmpName
bool CmpName(char *Wildcard,char *Name,int CmpPath)
{
if (CmpPath!=MATCH_NAMES)
{
int WildLength=strlen(Wildcard);
if (CmpPath!=MATCH_EXACTPATH && strnicompc(Wildcard,Name,WildLength)==0)
{
char NextCh=Name[WildLength];
if (NextCh=='\\' || NextCh=='/' || NextCh==0)
return(true);
}
char Path1[NM],Path2[NM];
GetFilePath(Wildcard,Path1);
GetFilePath(Name,Path2);
if (stricompc(Wildcard,Path2)==0)
return(true);
if ((CmpPath==MATCH_PATH || CmpPath==MATCH_EXACTPATH) && stricompc(Path1,Path2)!=0)
return(false);
if (CmpPath==MATCH_SUBPATH || CmpPath==MATCH_WILDSUBPATH)
if (IsWildcard(Path1))
return(match(Wildcard,Name));
else
if (CmpPath==MATCH_SUBPATH || IsWildcard(Wildcard))
{
if (*Path1 && strnicompc(Path1,Path2,strlen(Path1))!=0)
return(false);
}
else
if (stricompc(Path1,Path2)!=0)
return(false);
}
char *Name1=PointToName(Wildcard);
char *Name2=PointToName(Name);
if (strnicompc("__rar_",Name2,6)==0)
return(false);
return(match(Name1,Name2));
}
示例14: assign
void Panel::DragMessage(int X,int Y,int Move)
{
const auto SelCount = SrcDragPanel->GetSelCount();
if (!SelCount)
return;
string strSelName;
if (SelCount == 1)
{
os::fs::find_data Data;
if (!SrcDragPanel->get_first_selected(Data))
return;
assign(strSelName, PointToName(Data.FileName));
QuoteSpace(strSelName);
}
else
{
strSelName = format(msg(lng::MDragFiles), SelCount);
}
auto strDragMsg = format(msg(Move? lng::MDragMove : lng::MDragCopy), strSelName);
auto Length = static_cast<int>(strDragMsg.size());
int MsgX = X;
if (Length + X > ScrX)
{
MsgX=ScrX-Length;
if (MsgX<0)
{
MsgX=0;
TruncStrFromEnd(strDragMsg,ScrX);
Length=(int)strDragMsg.size();
}
}
SCOPED_ACTION(ChangePriority)(THREAD_PRIORITY_NORMAL);
// Important - the old one must be deleted before creating a new one, not after
DragSaveScr.reset();
DragSaveScr = std::make_unique<SaveScreen>(MsgX, Y, MsgX + Length - 1, Y);
GotoXY(MsgX,Y);
SetColor(COL_PANELDRAGTEXT);
Text(strDragMsg);
}
示例15: GetProcessInfo
bool GetProcessInfo(LPCWSTR asExeName, PROCESSENTRY32W* Info)
{
struct cmp
{
static bool compare(PROCESSENTRY32W* p, LPARAM lParam)
{
LPCWSTR pszName1 = PointToName(p->szExeFile);
LPCWSTR pszName2 = (LPCWSTR)lParam;
int iCmp = lstrcmpi(pszName1, pszName2);
return (iCmp == 0);
};
};
LPCWSTR pszName = PointToName(asExeName);
if (!pszName || !*pszName)
return false;
return GetProcessInfo(cmp::compare, (LPARAM)pszName, Info);
}