本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}