The $sketchup_version global var
-
Anyone know offhand what script is defining the
$sketchup_version
global variable. It's worthless as is (when the build number is above 999.) -
Its defined in our C++ code. I took a look at what's going on.
It does-<span class="syntaxdefault"> static VALUE g_SketchUp_Version </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> GetRubyInterface</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">ver</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">GetVersion</span><span class="syntaxkeyword">());<br /></span><span class="syntaxdefault"> rb_define_readonly_variable</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"$sketchup_version"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&</span><span class="syntaxdefault">g_SketchUp_Version</span><span class="syntaxkeyword">);</span><span class="syntaxdefault"> </span>
Just to show some history of SU code-
<span class="syntaxdefault">int CVersionInfo</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">GetVersion</span><span class="syntaxkeyword">()</span><span class="syntaxdefault"> const </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault"> return CVersionInfo</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">GetVersion</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">m_major</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> m_minor</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> m_buildNumber</span><span class="syntaxkeyword">);<br />}<br /><br /></span><span class="syntaxdefault">int CVersionInfo</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">GetVersion</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">int major</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> int minor</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> int build</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment">// This is a MAJOR KLUDGE necessary because we never anticipated over 1000<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment">// builds for a single SketchUp release. SketchUp depends on a version number<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment">// of the form 1000000 * Major release number + 1000 * Minor release number +<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment">// build number. Thus if the build number exceeds 999, it rolls over to the<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment">// minor build number - which is wrong. On the RASH assumption that no one<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment">// REALLY cares about the build number anymore and that the minor release<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment">// number will never exceed 999, I made the following modification;<br /></span><span class="syntaxdefault"> if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">minor </span><span class="syntaxkeyword">></span><span class="syntaxdefault"> 999</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> minor </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 999</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault"> if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">build </span><span class="syntaxkeyword">></span><span class="syntaxdefault"> 999</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> build </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 999</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault"> return </span><span class="syntaxkeyword">((</span><span class="syntaxdefault">major </span><span class="syntaxkeyword">*</span><span class="syntaxdefault"> 1000000</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">minor </span><span class="syntaxkeyword">*</span><span class="syntaxdefault"> 1000</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> build</span><span class="syntaxkeyword">);<br />}</span><span class="syntaxdefault"> </span>
-
@Dan,
on a mac
>
export FOO=$(defaults read '/Applications/Google SketchUp 8/SketchUp.app/Contents/Info' 'CFBundleVersion')
printf "Version: %s\n" $FOOVersion: 8.0.11751
is there a similar way for PC's?
john -
I should say that... my post was not really about the MR/build number problem... (I worded it wrong.. because I had a moment of exasperation.)
... I wanted to track down the culprit script.. because a
$sketchup_version
global variable is really worthless, should not be a variable and should be a constant, within theSketchup
namespace.We have several other topic threads, discussing the MR/build problem in the value returned by the
Sketchup.version_number()
method.Which I feel strongly that it should be deprecated and marked as such in the API dictionary.
-
@driven said:
is there a similar way for PC's?
Well, John, we would use within Ruby the cross-platform method call:
puts Sketchup.version()
Add: From the shell, there IS a command line utility, that can ask EXE and DLL files what their version is (provided they followed certain rules before compiling.) Some Ruby specific DLL files do not do this, and most SO files don't.
I just cannot remember offhand what the name of the utility is ...EDIT: I now rememeber the utility on PC, it's:
%(#BF4000)["C:/Program Files/Support Tools/filever.exe"]
If you have the "Support Files" installed it's likely it's folder is in your path... so if your in the Sketchup program directory...
%(#BF4000)[filever sketchup.exe] %(#000000)[>>] %(#BF4000)[--a-- W32i APP ENU 8.0.11752.0 shp 12,152,832 11-26-2011 sketchup.exe]
Advertisement