For opensource code, etc, it is beneficial that it works across different versions of the IDE. It’s also beneficial that code generates as few (hopefully none) warnings as possible when it’s being analyzed, especially when opensource projects are catered towards a beginner community.
For instance FolderItem.Absolute Path was ok up until now. Starting with Xojo 2013r1, a deprecation warning is displayed, advising the user to use FolderItem.NativePath. However, NativePath is not recognized by any REALStudio version.
So, to avoid that, one would write their code like this:
#if RBVersion >= 2013
// use NativePath
#else
// use AbsolutePath
#endif
This works fine on REALStudio as well as Xojo, but Xojo generates a deprecation warning saying that XojoVersion should be used instead of RBVersion. However, as expected, XojoVersion is not recognized by any REALStudio version.
Is there a way to distinguish the version of the ID being used without causing warnings or errors on one version or the other?
You are correct, the IDE doesn’t warn about this yet, but the language reference clearly states that RBVersion has been deprecated in favor of XojoVersion: http://documentation.xojo.com/index.php/RBVersion
[quote=11396:@Roger Meier]You are correct, the IDE doesn’t warn about this yet, but the language reference clearly states that RBVersion has been deprecated in favor of XojoVersion: http://documentation.xojo.com/index.php/RBVersion[/quote]
The documentation page says it’s deprecated, but the official deprecations listing doesn’t mention it. My guess is that RBVersion is now deprecated but isn’t slated for removal. I doubt Xojo would make so much old code instantly broken for branding purposes.
I’ve been using this and then just doing a global search and replace between “AbsolutePath” and “AbsolutePath_”
Function AbsolutePath_(Extends f As FolderItem) As String
#If RBVersion >= 2013 Then
Return f.NativePath
#Else
Return f.AbsolutePath
#endif
End Function
You could do something similar, and appending the ending slash if need be.
[quote=11422:@Andrew Lambert]I’ve been using this and then just doing a global search and replace between “AbsolutePath” and “AbsolutePath_”
Function AbsolutePath_(Extends f As FolderItem) As String
#If RBVersion >= 2013 Then
Return f.NativePath
#Else
Return f.AbsolutePath
#endif
End Function
You could do something similar, and appending the ending slash if need be.[/quote]
That’s a nice and simple solution and will work until <https://xojo.com/issue/26264> gets some attention and it gets fixed.
Everything from Real Studio has been aliased in Xojo. So you can use the keywords inversely… and there is a reason why alpha and beta information stays alpha/beta information. There is alpha information beta users cannot see as well within the development hierarchy. When it is no longer alpha/beta information, it is released for viewing…being fixed today you won’t see it in place until 2013r1.1