sugestion

Questions about wxWidgets running on MS.NET, mono or Portable.NET ? Ask it here !
Post Reply
xml
Earned a small fee
Earned a small fee
Posts: 13
Joined: Fri Oct 22, 2004 1:21 pm

sugestion

Post by xml »

in a previous post it was said

Code: Select all

                 public char this[long i]
                {
#if __WXMSW__
                        get { return wxString_CharAt(wxObject, (uint)i); }
#else
                        get {return System.Convert.ToChar(wxString_CharAtInt(wxObject, (uint)i)); }
#endif                       
                }
 
couldnt the #if __WXMSW__ be replaced with RunningOnWindows() where this function was

Code: Select all

bool RunningInWindows()
 {
   return (System.IO.Path.DirectorySeparatorChar == "\");
 } 
so the wx.net.dll assembly would be the same on windows and linux
AHUser
In need of some credit
In need of some credit
Posts: 3
Joined: Thu Oct 28, 2004 11:40 pm

Post by AHUser »

return (System.IO.Path.DirectorySeparatorChar == "\");
That is not a really good code for a platform decission.

I would prefere something like this:

Code: Select all

bool RunningInWindows()
{
  return System.Environment.OSVersion.Platform < (System.PlatformID)127;
}
127 is PlatformID.Unix which is not defined in enum System.PlatformID.
Post Reply