Is there a way to determine the file version attribute in win32 using Ruby?
I would like to report and compare file versions between 2 different windows
computers using Ruby. I am mainly concerned with dll, ocx and exe file
types.
Thanks for any help.
Phil
I use filever.exe (download from [1] and/or win xp sp2 cd) and this:
module Win
class Version
class << self
# returns version as array i.e. [1, 2, 12312, 5] or
# empty array
def get_version_array(path)
(get_version(path) || '').split('.').collect {|i| i.to_i}
end
# return version as string ('1.2.12312.5') or nil
def get_version(path)
ver = short(path)
ver.empty? ? nil : ver[14..30].strip
end
def short(path)
`filever /B /A "#{Path.to_win(path)}" 2>&1`
end
def full(path)
`filever.exe /V "#{Path.to_win(path)}" 2>&1`
end
end
end
end
[1] http://www.microsoft.com/downloads/details.aspx?FamilyId=49AE8576-9BB9-4126-9761-BA8011FABF38&displaylang=en
···
On 10/3/06, Phil Wilson <canuckdba@gmail.com> wrote:
Is there a way to determine the file version attribute in win32 using Ruby?
I would like to report and compare file versions between 2 different windows
computers using Ruby. I am mainly concerned with dll, ocx and exe file
types.
Thanks for any help.
Phil
look at this thread as well:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/161050
this is the WINAPI funciton to call:
···
On 10/3/06, Jan Svitok <jan.svitok@gmail.com> wrote:
On 10/3/06, Phil Wilson <canuckdba@gmail.com> wrote:
> Is there a way to determine the file version attribute in win32 using Ruby?
> I would like to report and compare file versions between 2 different windows
> computers using Ruby. I am mainly concerned with dll, ocx and exe file
> types.
>
> Thanks for any help.
> Phil
Thanks, I'll take a look.