actually, let's always get the size/date
This commit is contained in:
@@ -35,28 +35,24 @@ bool GetFileVersion( CString fn, CString &out )
|
|||||||
CString sRes = ssprintf( "\\StringFileInfo\\%04x%04x\\FileVersion",
|
CString sRes = ssprintf( "\\StringFileInfo\\%04x%04x\\FileVersion",
|
||||||
iTrans[0], iTrans[1] );
|
iTrans[0], iTrans[1] );
|
||||||
if( !VerQueryValue( (void *) VersionBuffer.c_str(), (char *) sRes.c_str(),
|
if( !VerQueryValue( (void *) VersionBuffer.c_str(), (char *) sRes.c_str(),
|
||||||
(void **) &str, &len ) )
|
(void **) &str, &len ) || len < 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
out = CString( str, len );
|
out = CString( str, len-1 );
|
||||||
return true;
|
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
/* If we can't get the file version, let's at least try to get the
|
/* Get the size and date. */
|
||||||
* size and date. */
|
struct stat st;
|
||||||
do {
|
if( stat( fn, &st ) != -1 )
|
||||||
struct stat st;
|
{
|
||||||
if( stat( fn, &st ) == -1 )
|
|
||||||
break;
|
|
||||||
|
|
||||||
struct tm t;
|
struct tm t;
|
||||||
gmtime_r( &st.st_mtime, &t );
|
gmtime_r( &st.st_mtime, &t );
|
||||||
out = ssprintf( "%ib, %02i-%02i-%04i", st.st_size, t.tm_mon, t.tm_mday, t.tm_year+1900 );
|
if( !out.empty() )
|
||||||
|
out += " ";
|
||||||
|
out += ssprintf( "[%ib, %02i-%02i-%04i]", st.st_size, t.tm_mon, t.tm_mday, t.tm_year+1900 );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} while(0);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CString FindSystemFile( CString fn )
|
CString FindSystemFile( CString fn )
|
||||||
|
|||||||
Reference in New Issue
Block a user