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


C++ wxFileName::GetTimes方法代码示例

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


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

示例1: GetDirectoryInfo

std::string wgfc::GetDirectoryInfo (const wxFileName &fname)
{
	infoFileSize_ = 0;
	infoFileCount_ = 0;
	infoDirCount_ = 0;
	std::string str("Directory is: ");
	wxDateTime crtm, mdtm, actm;

	wxDir dir (fname.GetFullPath());
	if (!dir.IsOpened()) {
		wxFileName fn (fname.GetFullPath());

		str = "File is: ";
		str += fname.GetFullPath().c_str() + "\n\n";
		wxDateTime crtm, mdtm, actm;
		std::string u8s = fname.GetFullPath().utf8_str().data();
		wxString crstr (OSXFileAttributes::getFileCreationDate(u8s).c_str(), wxConvUTF8);
		str += std::string("Created on: ") + crstr + "\n";
		
		if (fname.GetTimes (&actm, &mdtm, &crtm)) {
			wxString mdstr = mdtm.Format ("%a %b %d %Y  %X");
			str += std::string("Modified on: ") + mdstr + "\n";
		}
		//return "";
	}
	else {
		getInfo (fname);
		str += fname.GetFullPath().c_str() + "\n\n";
		
		// sys/time.h
		//int	utimes(const char *, const struct timeval *);
		
		//#include <sys/time.h>	
		//int	futimes(int fildes, const struct timeval times[2]);
		//int	utimes(const char *path, const struct timeval times[2]);
		
		std::string u8s = fname.GetFullPath().utf8_str().data();
		wxString crstr (OSXFileAttributes::getFileCreationDate(u8s).c_str(), wxConvUTF8);
		str += std::string("Created on: ") + crstr + "\n";
		
		if (fname.GetTimes (&actm, &mdtm, &crtm)) {
			wxString mdstr = mdtm.Format ("%a %b %d %Y  %X");
			str += std::string("Modified on: ") + mdstr + "\n";
		}
		wxString sizestr;
		sizestr << "Total number of subdirectories: " << infoDirCount_ << "\n"
		<< "Total number of files: " << infoFileCount_ << "\n"
		<< "Total size: " << getSizeString(infoFileSize_) << "\n";
		str += sizestr.c_str();
	}
	

	return str;
}
开发者ID:wolfganggo,项目名称:FileTool-AIR-,代码行数:54,代码来源:Utilities.cpp

示例2: EnumerateMemoryCard

//sets IsPresent if the file is valid, and derived properties (filename, formatted, size, etc)
bool EnumerateMemoryCard( McdSlotItem& dest, const wxFileName& filename, const wxDirName basePath )
{
	dest.IsFormatted	= false;
	dest.IsPresent		= false;

	const wxString fullpath( filename.GetFullPath() );
	if( !filename.FileExists() ) return false;

	DevCon.WriteLn( fullpath );
	wxFFile mcdFile( fullpath );
	if( !mcdFile.IsOpened() ) return false;	// wx should log the error for us.
	if( mcdFile.Length() < (1024*528) )
	{
		Console.Warning( "... MemoryCard appears to be truncated.  Ignoring." );
		return false;
	}

	dest.IsPresent		= true;
	dest.Filename		= filename;
	if( filename.GetFullPath() == (basePath+filename.GetFullName()).GetFullPath() )
		dest.Filename = filename.GetFullName();

	dest.SizeInMB		= (uint)(mcdFile.Length() / (1024 * 528 * 2));
	dest.IsFormatted	= IsMcdFormatted( mcdFile );
	filename.GetTimes( NULL, &dest.DateModified, &dest.DateCreated );

	return true;
}
开发者ID:madnessw,项目名称:thesnow,代码行数:29,代码来源:MemoryCardListPanel.cpp

示例3: Test_Date

int Test_Date(wxString FileName)
{
    FN.Assign(FileName);
    if (!FN.FileExists())
    {
        ToShow+=FileName;
        ToShow+=__T(" does not exist");
        return -1;
    }
    if (!FN.GetTimes(&Access, NULL, NULL))
    {
        ToShow+=__T("Error getting date of ");
        ToShow+=FileName;
        return -1;
    }
    wxTimeSpan TS=wxDateTime::Now()-Access;
    if (TS.GetWeeks()>0 || TS.GetDays()>0 || TS.GetHours()>0 || TS.GetMinutes()>0)
    {
        ToShow+=FileName;
        ToShow+=__T(" is old : was compiled");
        ToShow+=TS.Format().c_str();
        ToShow+=__T(" ago\r\n");
    }
    return 0;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:25,代码来源:OldFiles.cpp

示例4: EnumerateMemoryCard

//sets IsPresent if the file is valid, and derived properties (filename, formatted, size, etc)
bool EnumerateMemoryCard( McdSlotItem& dest, const wxFileName& filename, const wxDirName basePath )
{
	dest.IsFormatted	= false;
	dest.IsPresent		= false;
	dest.IsPSX			= false;
	dest.Type			= MemoryCardType::MemoryCard_None;

	const wxString fullpath( filename.GetFullPath() );
	//DevCon.WriteLn( fullpath );
	if ( filename.FileExists() ) {
		// might be a memory card file
		wxFFile mcdFile( fullpath );
		if ( !mcdFile.IsOpened() ) { return false; }	// wx should log the error for us.

		wxFileOffset length = mcdFile.Length();

		if( length < (1024*528) && length != 0x20000 )
		{
			Console.Warning( "... MemoryCard appears to be truncated.  Ignoring." );
			return false;
		}

		dest.SizeInMB = (uint)( length / ( 1024 * 528 * 2 ) );

		if ( length == 0x20000 ) {
			dest.IsPSX = true; // PSX memcard;
			dest.SizeInMB = 1; // MegaBIT
		}

		dest.Type = MemoryCardType::MemoryCard_File;
		dest.IsFormatted = IsMcdFormatted( mcdFile );
		filename.GetTimes( NULL, &dest.DateModified, &dest.DateCreated );
	} else if ( filename.DirExists() ) {
		// might be a memory card folder
		wxFileName superBlockFileName( fullpath, L"_pcsx2_superblock" );
		if ( !superBlockFileName.FileExists() ) { return false; }
		wxFFile mcdFile( superBlockFileName.GetFullPath() );
		if ( !mcdFile.IsOpened() ) { return false; }
		
		dest.SizeInMB = 0;

		dest.Type = MemoryCardType::MemoryCard_Folder;
		dest.IsFormatted = IsMcdFormatted( mcdFile );
		superBlockFileName.GetTimes( NULL, &dest.DateModified, &dest.DateCreated );
	} else {
		// is neither
		return false;
	}

	dest.IsPresent		= true;
	dest.Filename		= filename;
	if( filename.GetFullPath() == (basePath+filename.GetFullName()).GetFullPath() )
		dest.Filename = filename.GetFullName();
	
	return true;
}
开发者ID:Alchemistxxd,项目名称:pcsx2,代码行数:57,代码来源:MemoryCardListPanel.cpp


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