本文整理汇总了C++中OsPath::Filename方法的典型用法代码示例。如果您正苦于以下问题:C++ OsPath::Filename方法的具体用法?C++ OsPath::Filename怎么用?C++ OsPath::Filename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsPath
的用法示例。
在下文中一共展示了OsPath::Filename方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wdll_ver_Append
void wdll_ver_Append(const OsPath& pathname, VersionList& list)
{
if(pathname.empty())
return; // avoid error in ReadVersionString
// pathname may not have an extension (e.g. driver names from the
// registry). note that always appending ".dll" would be incorrect
// since some have ".sys" extension.
OsPath modulePathname(pathname);
if(modulePathname.Extension() == "")
modulePathname = modulePathname.ChangeExtension(L".dll");
const OsPath moduleName(modulePathname.Filename());
// read file version. try this with and without FS redirection since
// pathname might assume both.
wchar_t versionString[500]; // enclosed in () below
if(ReadVersionString(modulePathname, versionString, ARRAY_SIZE(versionString)) != INFO::OK)
{
WinScopedDisableWow64Redirection s;
// still failed; avoid polluting list with DLLs that don't exist
// (requiring callers to check for their existence beforehand would be
// onerous and unreliable)
if(ReadVersionString(modulePathname, versionString, ARRAY_SIZE(versionString)) != INFO::OK)
return;
}
if(!list.empty())
list += L", ";
list += moduleName.Filename().string();
list += L" (";
list += versionString;
list += L")";
}
示例2: GetVirtualPath
virtual Status GetVirtualPath(const OsPath& realPathname, VfsPath& pathname)
{
ScopedLock s;
const OsPath realPath = realPathname.Parent()/"";
VfsPath path;
RETURN_STATUS_IF_ERR(FindRealPathR(realPath, m_rootDirectory, L"", path));
pathname = path / realPathname.Filename();
return INFO::OK;
}
示例3: GetFileInfo
Status GetFileInfo(const OsPath& pathname, CFileInfo* pPtrInfo)
{
errno = 0;
struct stat s;
memset(&s, 0, sizeof(s));
if(wstat(pathname, &s) != 0)
WARN_RETURN(StatusFromErrno());
*pPtrInfo = CFileInfo(pathname.Filename(), s.st_size, s.st_mtime);
return INFO::OK;
}
示例4: fsevent_callback
static void fsevent_callback(
ConstFSEventStreamRef UNUSED(streamRef),
void * UNUSED(clientCallBackInfo),
size_t numEvents,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId UNUSED(eventIds)[] )
{
unsigned long i;
char **paths = (char **)eventPaths;
for (i=0; i<numEvents; i++)
{
bool isWatched = false;
OsPath eventPath = OsPath(paths[i]);
unsigned long eventType = eventFlags[i];
if ( eventPath.Filename().string().c_str()[0] != '.' )
{
for ( DirWatchMap::iterator it = g_Paths.begin() ; it != g_Paths.end(); ++it)
if ( path_is_subpath( it->path.string().c_str(), eventPath.string().c_str() ) )
isWatched = true;
}
if ( ! isWatched )
return;
OsPath filename = Path( eventPath.string().c_str() );
if ( eventType & kFSEventStreamEventFlagItemIsFile)
{
if ( eventType & kFSEventStreamEventFlagItemRemoved )
g_QueuedDirs.push_back(DirWatchNotification( filename.string().c_str(), DirWatchNotification::Deleted ));
else if ( eventType & kFSEventStreamEventFlagItemRenamed )
g_QueuedDirs.push_back(DirWatchNotification( filename.string().c_str(), DirWatchNotification::Deleted ));
else if ( eventType & kFSEventStreamEventFlagItemCreated )
g_QueuedDirs.push_back(DirWatchNotification( filename.string().c_str(), DirWatchNotification::Created ));
else if ( eventType & kFSEventStreamEventFlagItemModified )
g_QueuedDirs.push_back(DirWatchNotification( filename.string().c_str(), DirWatchNotification::Changed ));
}
}
}