Find out what's your file's architecture using Ruby! - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Material Development (https://www.save-point.org/forum-8.html) +--- Forum: Tools (https://www.save-point.org/forum-42.html) +--- Thread: Find out what's your file's architecture using Ruby! (/thread-7516.html) |
Find out what's your file's architecture using Ruby! - kyonides - 08-03-2019 After searching for an easy way to find out if an executable or library were meant to be run on x86 alias i386 (or i486 or i586) or x64 alias amd64 OS, I stumbled upon perl and python scripts. Then I thought there got to be a way to do it with Ruby and I was right! Code: def arch_of(fn) I felt great for finding it out myself, when I opened another website and read how another github user had posted a similar script a few years ago... Anyway, now you can use it to get an extensive list of what file has what kind of architecture! Just replace "puts" with "print" or in case you're an experienced scripter, you might already know how to store the results in a TXT file you can read at anytime. I think it can even run if you copy and paste it on the maker's script editor. RE: Find out what's your file's architecture using Ruby! - DerVVulfman - 09-01-2019 This works fine to perform a test upon Game.Exe and the accompanying RGSS.dll, these being in the root directory of the project. So quite often, anyone running this will receive the same response as any other. Would there be a script available to test the architecture of the computer running said program, testing if it is in a Windows, Mac or Linux environment? RE: Find out what's your file's architecture using Ruby! - kyonides - 09-02-2019 Actually, that would be feasible indeed. It's not complicated at all. RE: Find out what's your file's architecture using Ruby! - DerVVulfman - 09-08-2019 Well... guess I'd have to provide an answer. For those thinking that RUBY_PLATFORM would do the trick, nope. It falters when Java is in use, returning 'Java' even if the PC itself was Windows, Mac or Linux. So I had to dig further. The main consensus is the use of RbConfig. Unfortunately, RPGMaker XP (or any) do not come supplied with it, and there are various versions as there are various versions of Ruby. But after examining various versions of RbConfig from versions 1.8.5 through to more modern 2., I determined that I had need of only a handful of lines. Below is a scriptette that can determine what Operating System your PC is using, returning something like :windows, :linux, :unix or :macosx. Code: #============================================================================== You can replace the returned values (like :windows) with numeric values if it helps This will prove useful if one wishes to permit Win32DLL applications to run in their game for Windows Users, and perhaps have a workaround for those without. RE: Find out what's your file's architecture using Ruby! - kyonides - 09-09-2019 Use the more conventional Module.method notation instead, even for rubyists it's weird to use double colon for calling such module method. |