Finding the file version of a win32 dll in Ruby

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

On 10/3/06, Jan S. [email protected] wrote:

On 10/3/06, Phil W. [email protected] 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:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/versioninformation/versioninformationreference/versioninformationfunctions/getfileversioninfo.asp

On 10/3/06, Phil W. [email protected] 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

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

Thanks, I’ll take a look.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs