本文整理汇总了C++中IF_FileSystem::pathReduce方法的典型用法代码示例。如果您正苦于以下问题:C++ IF_FileSystem::pathReduce方法的具体用法?C++ IF_FileSystem::pathReduce怎么用?C++ IF_FileSystem::pathReduce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IF_FileSystem
的用法示例。
在下文中一共展示了IF_FileSystem::pathReduce方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: next
RCODE FTKAPI F_DirHdl::next( void)
{
char szFoundPath[ F_PATH_MAX_SIZE];
char szDummyPath[ F_PATH_MAX_SIZE];
FLMUINT uiSearchAttributes;
FLMUINT uiFoundAttrib;
IF_FileSystem * pFileSystem = f_getFileSysPtr();
if( RC_BAD( m_rc))
{
goto Exit;
}
uiSearchAttributes =
F_IO_FA_NORMAL | F_IO_FA_RDONLY | F_IO_FA_ARCHIVE | F_IO_FA_DIRECTORY;
for( ;;)
{
if( m_bFirstTime)
{
m_bFirstTime = FALSE;
if( RC_BAD( m_rc = f_fileFindFirst( m_szDirectoryPath,
uiSearchAttributes, &m_FindData, szFoundPath, &uiFoundAttrib)))
{
goto Exit;
}
m_bFindOpen = TRUE;
m_uiAttrib = uiFoundAttrib;
}
else
{
if( RC_BAD( m_rc = f_fileFindNext( &m_FindData,
szFoundPath, &uiFoundAttrib)))
{
goto Exit;
}
m_uiAttrib = uiFoundAttrib;
}
if( RC_BAD( m_rc = pFileSystem->pathReduce( szFoundPath,
szDummyPath, m_szFileName)))
{
goto Exit;
}
if( pFileSystem->doesFileMatch( m_szFileName, m_szPattern))
{
break;
}
}
Exit:
return( m_rc);
}
示例2: createDir
RCODE FTKAPI F_DirHdl::createDir(
const char * pszDirPath)
{
RCODE rc = NE_FLM_OK;
char * pszParentDir = NULL;
IF_FileSystem * pFileSystem = f_getFileSysPtr();
if( RC_BAD( rc = f_alloc( F_PATH_MAX_SIZE, &pszParentDir)))
{
goto Exit;
}
// Discover the parent directory of the given one
if( RC_BAD( rc = pFileSystem->pathReduce( pszDirPath,
pszParentDir, NULL)))
{
goto Exit;
}
// If pathReduce couldn't reduce the path at all, then an
// invalid path was supplied.
if( f_strcmp( pszDirPath, pszParentDir) == 0)
{
rc = RC_SET( NE_FLM_IO_INVALID_FILENAME);
goto Exit;
}
// If a parent directory was found, and it doesn't already exist, create it
if( *pszParentDir)
{
// If the "parent" is actually a regular file we need to return an error
if( RC_OK( pFileSystem->doesFileExist( pszParentDir)))
{
if( !pFileSystem->isDir( pszParentDir))
{
rc = RC_SET( NE_FLM_IO_ACCESS_DENIED);
goto Exit;
}
}
else if( RC_BAD( rc = createDir( pszParentDir)))
{
goto Exit;
}
}
#if defined( FLM_WIN)
if( !CreateDirectory((LPTSTR)pszDirPath, NULL))
{
rc = f_mapPlatformError( GetLastError(), NE_FLM_CREATING_FILE);
}
#elif defined( FLM_UNIX) || defined( FLM_LIBC_NLM)
if( mkdir( (char *)pszDirPath, 0777) == -1)
{
rc = f_mapPlatformError( errno, NE_FLM_CREATING_FILE);
}
#endif
Exit:
if( pszParentDir)
{
f_free( &pszParentDir);
}
return( rc);
}