Пример #1
0
KDint xmBadaRename ( const KDchar* _old, const KDchar* _new )
{
	FileAttributes attr;
	result         r;

	r = File::GetAttributes ( _old, attr );

	if ( IsFailed ( r ) )
	{
		goto failed;
	}

	if ( attr.IsDirectory ( ) )
	{
		r = Directory::Rename ( _old, _new );
	}
	else
	{
		r = File::Move ( _old, _new );
	}

	if ( IsFailed ( r ) )
	{
		goto failed;
	}

	return 0;

failed :

	xmBadaSetError ( r );

	return -1;
}
Пример #2
0
KDint xmBadaStat ( const KDchar* path, struct stat* buf )
{
	struct tm       t;
	FileAttributes  attr;
	DateTime        dt;
	result          r;

	r = File::GetAttributes ( path, attr );

	if ( IsFailed ( r ) )
	{
		goto failed;
	}

	dt = attr.GetLastModifiedTime ( );

	t.tm_year = dt.GetYear   ( );
	t.tm_mon  = dt.GetMonth  ( ) - 1;
	t.tm_mday = dt.GetDay    ( );
	t.tm_hour = dt.GetHour   ( );
	t.tm_min  = dt.GetMinute ( );
	t.tm_sec  = dt.GetSecond ( );

	buf->st_mtime = mktime ( &t );
	buf->st_mode  = attr.IsDirectory ( ) ? 0x4000 : 0x8000;
	buf->st_size  = attr.GetFileSize ( );

	return 0;

failed :

	xmBadaSetError ( r );

	return -1;
}
Пример #3
0
ZLFileInfo ZLbadaFSManager::fileInfo(const std::string &path) const {
	AppLog("ZLbadaFSManager::fileInfo %s",path.c_str());
	ZLFileInfo info;
	//struct stat fileStat;
    result r = E_SUCCESS;
    FileAttributes attr;
    Tizen::Base::String badaPath(path.c_str());
    r = File::GetAttributes(badaPath, attr);
   //TODO if(IsFailed(r)) goto CATCH;

	//info.Exists = stat(path.c_str(), &fileStat) == 0; stat - не работает
    info.Exists = (r==E_SUCCESS);

	AppLog("ZLbadaFSManager::fileInfo r = %d", r);
	if (info.Exists) {
		info.Size = attr.GetFileSize();//fileStat.st_size;
		//AppLog("ZLbadaFSManager::fileInfo.Size %d",fileStat.st_size);
		AppLog("ZLbadaFSManager::fileInfo.Size %d",info.Size);
		//AppLog("ZLbadaFSManager::fileInfo.st_mode %x",fileStat.st_mode);
		info.IsDirectory = attr.IsDirectory();//S_ISDIR(fileStat.st_mode);
		if (info.IsDirectory) AppLog("ZLbadaFSManager::fileInfo.IsDirectory");
	}
	return info;
}