怎样在inno中判断文件大小? ( 积分: 200 )

  • 主题发起人 主题发起人 yesky_2008
  • 开始时间 开始时间
Y

yesky_2008

Unregistered / Unconfirmed
GUEST, unregistred user!
需要在inno中判断原来目录中存在文件的大小,如小于一定数值则拷贝安装包内的相同文件覆盖原来文件,如不小于则不拷贝,请教怎么做?是否能给个例子?
 
需要在inno中判断原来目录中存在文件的大小,如小于一定数值则拷贝安装包内的相同文件覆盖原来文件,如不小于则不拷贝,请教怎么做?是否能给个例子?
 
这个只能自己写脚本,判断、复制函数有内置的:
int FileSize(str)
Returns size, in bytes, of the specified file. If the filedo
es not exist, the result is -1. Beware of ISPP supporting only signed 32 bit integers: for files larger than 2 GB (and smaller than 4 GB) the result is negative.
void CopyFile(str 1, str 2)
Copies a file.
void DeleteFile(str)
Marks file for deletion after compilation isdo
ne (no matter successful it was or not).do
es not return anything.
str GetFileVersion(str)
GetFileVersion function takes string argument which must be set to the name of the file whose version information is to be queried. The function returns string composed of four decimal numbers delimitted with periods. If filedo
es not contain valid version info, the function returns an empty string.
ISPP also has GetStringFileInfo function, which also can be used to retrieve file version (using "FileVersion"
or "ProductVersion"
as second parameter). The difference is that GetFileVersion takes it from fixed block of version info, unlike GetStringFileInfo, which extracts string from language specific block.
 
inno中的filesize是设置文件大小,而不是给出。有哪个函数是给出当前指定文件的大小?
Prototype:
function FileSize(const Name: String;
var Size: Integer): Boolean;
Description:
Sets Size to the size of the specified file in bytes. Returns True if the file size was set successfully and False otherwise.
 
你说的如何设置size?
若文件的长度大于你给的Size,剪掉么?
若文件的长度<于你给的Size,补0么?
那就用TFileStream来写.
inno setup支持TFileStream对象的.
 
只需要判断指定文件大小,
若文件的长度<于你给的Size,不拷贝,否则拷贝文件
要在inno setup脚本中判断,能否给出例子。
 
后退
顶部