当前位置: 首页>>代码示例>>C++>>正文


C++ IF_FileSystem::pathAppend方法代码示例

本文整理汇总了C++中IF_FileSystem::pathAppend方法的典型用法代码示例。如果您正苦于以下问题:C++ IF_FileSystem::pathAppend方法的具体用法?C++ IF_FileSystem::pathAppend怎么用?C++ IF_FileSystem::pathAppend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IF_FileSystem的用法示例。


在下文中一共展示了IF_FileSystem::pathAppend方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: releaseLockFile

	FINLINE void releaseLockFile(
		const char *		pszBasePath,
		FLMBOOL				bDelete)
	{
#ifndef FLM_UNIX
		F_UNREFERENCED_PARM( bDelete);
		F_UNREFERENCED_PARM( pszBasePath);
#endif

		if( m_pLockFileHdl)
		{

			// Release the lock file

			(void)m_pLockFileHdl->closeFile();
			m_pLockFileHdl->Release();
			m_pLockFileHdl = NULL;

#ifdef FLM_UNIX
			if( bDelete)
			{
				IF_FileSystem *	pFileSystem = f_getFileSysPtr();
				char					szTmpPath[ F_PATH_MAX_SIZE];

				// Delete the lock file

				f_strcpy( szTmpPath, pszBasePath);
				pFileSystem->pathAppend( szTmpPath, "64.LCK");
				pFileSystem->deleteFile( szTmpPath);
			}
#endif
		}
	}
开发者ID:ajumi2,项目名称:libflaim,代码行数:33,代码来源:ftkmfh.cpp

示例2: dataFilePath

	FINLINE void dataFilePath(
		FLMUINT		uiFileNum,
		char *		pszPath)
	{
		char					szFileName[ 13];
		IF_FileSystem *	pFileSystem = f_getFileSysPtr();

		f_strcpy( pszPath, m_szPath);
		formatFileNum( uiFileNum, szFileName);
		pFileSystem->pathAppend( pszPath, szFileName);
	}
开发者ID:ajumi2,项目名称:libflaim,代码行数:11,代码来源:ftkmfh.cpp

示例3: f_fileFindNext

RCODE f_fileFindNext(
	F_IO_FIND_DATA *	pFindData,
	char *				pszFoundPath,
	FLMUINT *			puiFoundAttrib)
{
	RCODE					rc = NE_FLM_OK;
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();

   if( FindNextFile( pFindData->findHandle,
		&(pFindData->findBuffer)) == FALSE)
	{
		rc = f_mapPlatformError( GetLastError(), NE_FLM_READING_FILE);
		goto Exit;
	}

	// Loop until a file with correct attributes is found

	for( ;;)
	{
		if( f_fileMeetsFindCriteria( pFindData))
		{
			break;
		}

		if( FindNextFile( pFindData->findHandle,
			&(pFindData->findBuffer)) == FALSE)
		{
			rc = f_mapPlatformError( GetLastError(), NE_FLM_READING_FILE);
			goto Exit;
		}
	}

	// Append the file name to the path name

	f_strcpy( pszFoundPath, pFindData->szSearchPath);
	
	if( RC_BAD( rc = pFileSystem->pathAppend( pszFoundPath, 
		(char *)pFindData->findBuffer.cFileName)))
	{
		goto Exit;
	}

	// Return the found file attribute

   *puiFoundAttrib = pFindData->findBuffer.dwFileAttributes;

Exit:

   return( rc);
}
开发者ID:Tyrion-Lannister-274AL,项目名称:flaim,代码行数:50,代码来源:ftkdir.cpp

示例4: createLockFile

/****************************************************************************
Desc: This routine obtains exclusive access to a 64-bit file by creating
		a .lck file.  The object holds the .lck file open as long as the
		64-bit file is open.
****************************************************************************/
RCODE F_MultiFileHdl::createLockFile(
	const char *		pszBasePath)
{
	RCODE					rc = NE_FLM_OK;
	char					szLockPath [F_PATH_MAX_SIZE];
	F_FileHdl *			pLockFileHdl = NULL;
	FLMUINT				uiIoFlags = FLM_IO_RDWR | FLM_IO_EXCL | FLM_IO_SH_DENYRW;
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();

	f_strcpy( szLockPath, pszBasePath);
	pFileSystem->pathAppend( szLockPath, "64.LCK");

	// Attempt to create the lock file.  If it fails, the lock file
	// may have been left because of a crash.  Hence, we first try
	// to delete the file.  If that succeeds, we then attempt to
	// create the file again.  If it, or the 2nd create fail, we simply
	// return an access denied error.
	
	if( RC_BAD( rc = f_allocFileHdl( &pLockFileHdl)))
	{
		goto Exit;
	}

#ifndef FLM_UNIX
	// On Unix, we do not want to delete the file because it
	// will succeed even if someone else has the file open.
	
	uiIoFlags |= FLM_IO_DELETE_ON_RELEASE;
#endif

	if( RC_BAD( pLockFileHdl->createFile( szLockPath, uiIoFlags)))
	{
#ifndef FLM_UNIX
		if (RC_BAD( pFileSystem->deleteFile( szLockPath)))
		{
			rc = RC_SET( NE_FLM_IO_ACCESS_DENIED);
			goto Exit;
		}
		else if (RC_BAD( pLockFileHdl->createFile( szLockPath, uiIoFlags)))
		{
			rc = RC_SET( NE_FLM_IO_ACCESS_DENIED);
			goto Exit;
		}
#else

		if( RC_BAD( pLockFileHdl->openFile( szLockPath, uiIoFlags)))
		{
			rc = RC_SET( NE_FLM_IO_ACCESS_DENIED);
			goto Exit;
		}
#endif
	}

#ifdef FLM_UNIX
	if( RC_BAD( pLockFileHdl->lock()))
	{
		rc = RC_SET( NE_FLM_IO_ACCESS_DENIED);
		goto Exit;
	}
#endif

	m_pLockFileHdl = pLockFileHdl;
	pLockFileHdl = NULL;

Exit:

	if (pLockFileHdl)
	{
		(void)pLockFileHdl->closeFile();
		pLockFileHdl->Release();
		pLockFileHdl = NULL;
	}
	return( rc);
}
开发者ID:ajumi2,项目名称:libflaim,代码行数:79,代码来源:ftkmfh.cpp

示例5: createUniqueFile

/****************************************************************************
Desc:	Creates a new 64-bit file with a unique, generated name
****************************************************************************/
RCODE F_MultiFileHdl::createUniqueFile(
	const char *		pszPath,					// Directory where the file is to be created
	const char *		pszFileExtension)		// Extension to be used on the new file.
{
	RCODE					rc = NE_FLM_OK;
	FLMUINT				uiCount;
	FLMBOOL				bModext = TRUE;
	FLMBOOL				bCreatedDir = FALSE;
	FLMUINT				uiBaseTime = 0;
	FLMBYTE				ucHighByte = 0;
	char					szDirName[ F_FILENAME_SIZE];
	char					szTmpPath[ F_PATH_MAX_SIZE];
	char					szBasePath[ F_PATH_MAX_SIZE];
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();

	if( m_bOpen)
	{
		rc = RC_SET_AND_ASSERT( NE_FLM_FAILURE);
		goto Exit;
	}

	if( !pszPath || pszPath[ 0] == '\0')
	{
#if defined( FLM_UNIX)
		f_strcpy( szBasePath, "./");
#elif defined( FLM_NLM)
		f_strcpy( szBasePath, "SYS:_NETWARE");
#else
		szBasePath[ 0] = '\0';
#endif
	}
	else
	{
		f_strcpy( szBasePath, pszPath);
	}

	if ((pszFileExtension) && (f_strlen( pszFileExtension) >= 3))
	{
		bModext = FALSE;
	}

	uiCount = 0;
	szDirName[ 0] = '\0';
	do
	{
		pFileSystem->pathCreateUniqueName( &uiBaseTime, szDirName, 
				pszFileExtension, &ucHighByte, bModext);

		f_strcpy( szTmpPath, szBasePath);
		pFileSystem->pathAppend( szTmpPath, szDirName);
		rc = pFileSystem->createDir( szTmpPath);
	} while ((rc != NE_FLM_OK) && (uiCount++ < 20));

	if( RC_BAD( rc))
	{
		goto Exit;
	}

	f_strcpy( m_szPath, szTmpPath);
	bCreatedDir = TRUE;

	// Create the lock file

	if( RC_BAD( rc = createLockFile( m_szPath)))
	{
		goto Exit;
	}

	// Initialize the EOF to 0 and set the state to open

	m_ui64EOF = 0;
	m_bOpen = TRUE;

Exit:

	// Release the lock file

	if( RC_BAD( rc))
	{
		releaseLockFile( m_szPath, TRUE);

		if( bCreatedDir)
		{
			(void)pFileSystem->removeDir( m_szPath);
		}
	}

	return( rc);
}
开发者ID:ajumi2,项目名称:libflaim,代码行数:92,代码来源:ftkmfh.cpp

示例6: f_fileFindFirst

RCODE f_fileFindFirst(
	char *				pszSearchPath,
   FLMUINT				uiSearchAttrib,
	F_IO_FIND_DATA	*	pFindData,
   char *				pszFoundPath,
	FLMUINT *			puiFoundAttrib)
{
	RCODE					rc = NE_FLM_OK;
	char 					szTmpPath[ F_PATH_MAX_SIZE];
	FSTATIC char		pszWildCard[] = {'*',0};
	int					iRetVal;
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();

	if( !pszSearchPath)
	{
		rc = RC_SET( NE_FLM_IO_PATH_NOT_FOUND);
		goto Exit;
	}

	f_strcpy( szTmpPath, pszSearchPath);
	if( RC_BAD( rc = pFileSystem->pathAppend( szTmpPath, pszWildCard)))
	{
		goto Exit;
	}

	f_memset( pFindData, 0, sizeof( F_IO_FIND_DATA));
	if( uiSearchAttrib & F_IO_FA_DIRECTORY)
	{
		pFindData->mode_flag |= S_IFDIR;
	}

	if( uiSearchAttrib & F_IO_FA_RDONLY)
	{
		pFindData->mode_flag |= S_IREAD;
	}

	iRetVal = Find1( (char*)szTmpPath, pFindData);

	if( iRetVal != 0)
	{
		// If there were no more files found then return no more files
		// instead of mapping to error path not found or io error.
		// To return no more files ret_val is ENOENT (set in Find2)
		// and errno is not set

		if( iRetVal == ENOENT && errno == 0)
		{
			rc = RC_SET( NE_FLM_IO_NO_MORE_FILES);
		}
		else
		{
			rc = f_mapPlatformError( errno, NE_FLM_READING_FILE);
		}
		
		goto Exit;
	}

	// filter out ".." (PARENT) and "." (CURRENT) directories
	
	if( uiSearchAttrib & F_IO_FA_DIRECTORY )
	{
		while( (f_strcmp( pFindData->name, "..") == 0) ||
			   (f_strcmp( pFindData->name, ".") == 0))
		{
			if( (iRetVal = Find2( pFindData)) != 0)
			{
				// If there were no more files found then return no more files
				// instead of mapping to error path not found or io error.
				// To return no more files ret_val is ENOENT (set in Find2)
				// and errno is not set
				
				if( iRetVal == ENOENT && errno == 0)
				{
					rc = RC_SET( NE_FLM_IO_NO_MORE_FILES);
				}
				else
				{
					rc = f_mapPlatformError( errno, NE_FLM_READING_FILE);
				}
				
				goto Exit;
			}
		}
	}

	// Append the file name to the path name
	
	f_strcpy( pszFoundPath, pszSearchPath);
	
	if( RC_BAD( rc = pFileSystem->pathAppend( pszFoundPath, 
		(char *)pFindData->name)))
	{
		goto Exit;
	}

	*puiFoundAttrib = (FLMUINT)ReturnAttributes(
			pFindData->FileStat.st_mode, pszFoundPath);

	// Save the search path in the NE_FLM_IO_FIND_DATA struct
	// for a find next call
//.........这里部分代码省略.........
开发者ID:Tyrion-Lannister-274AL,项目名称:flaim,代码行数:101,代码来源:ftkdir.cpp


注:本文中的IF_FileSystem::pathAppend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。