Thread: OSValidator

Results 1 to 8 of 8
  1. #1 OSValidator 
    Extreme Donator

    Jilic-Matt's Avatar
    Join Date
    May 2011
    Age
    26
    Posts
    1,614
    Thanks given
    799
    Thanks received
    495
    Rep Power
    540
    i take no credit for this got from a google search(couldnt remeber indexOf("), even though its not remotely difficult.

    for those who arent sure its just a set of boolean's for checking the operating system, i hadnt seen it released so thought it may be handy for those wanting to make their clients more widely compatible

    Code:
    public class OSValidator {
     
    	private static String OS = System.getProperty("os.name").toLowerCase();
     
    
     
    	public static boolean isWindows() {
     
    		return (OS.indexOf("win") >= 0);
     
    	}
     
    	public static boolean isMac() {
     
    		return (OS.indexOf("mac") >= 0);
     
    	}
     
    	public static boolean isUnix() {
     
    		return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 );
     
    	}
     
    	public static boolean isSolaris() {
     
    		return (OS.indexOf("sunos") >= 0);
     
    	}
     
    }
    Reply With Quote  
     

  2. #2  
    ಠ_ಠ

    Joshua's Avatar
    Join Date
    May 2010
    Posts
    1,907
    Thanks given
    397
    Thanks received
    708
    Rep Power
    803
    Quote Originally Posted by Jilic-Matt View Post
    i take no credit for this got from a google search(couldnt remeber indexOf("), even though its not remotely difficult.

    for those who arent sure its just a set of boolean's for checking the operating system, i hadnt seen it released so thought it may be handy for those wanting to make their clients more widely compatible

    Code:
    public class OSValidator {
     
    	private static String OS = System.getProperty("os.name").toLowerCase();
     
    
     
    	public static boolean isWindows() {
     
    		return (OS.indexOf("win") >= 0);
     
    	}
     
    	public static boolean isMac() {
     
    		return (OS.indexOf("mac") >= 0);
     
    	}
     
    	public static boolean isUnix() {
     
    		return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 );
     
    	}
     
    	public static boolean isSolaris() {
     
    		return (OS.indexOf("sunos") >= 0);
     
    	}
     
    }
    Isn't Java already supposed to be multiplatform? I'm not sure you really need to do any system specific programming to get any of the features that are floating around r-s to work on any platform.




    [Only registered and activated users can see links. ]

    Spoiler for Eye Bleach & Recent Releases:



    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]


    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Extreme Donator

    Jilic-Matt's Avatar
    Join Date
    May 2011
    Age
    26
    Posts
    1,614
    Thanks given
    799
    Thanks received
    495
    Rep Power
    540
    Quote Originally Posted by Joshua View Post
    Isn't Java already supposed to be multiplatform? I'm not sure you really need to do any system specific programming to get any of the features that are floating around r-s to work on any platform.
    yes true, tbh the reason i needed this was an idea i had that would change certain things about the client depending on the platform (mac loading screen)(windows loading screen)(linux loading screen) etc.. got kinda bored of making all the different login screens so i stopped half way through mac thought if anyone had any similar ideas they might appreciate this
    Reply With Quote  
     

  5. Thankful user:


  6. #4  
    ಠ_ಠ

    Joshua's Avatar
    Join Date
    May 2010
    Posts
    1,907
    Thanks given
    397
    Thanks received
    708
    Rep Power
    803
    Quote Originally Posted by Jilic-Matt View Post
    yes true, tbh the reason i needed this was an idea i had that would change certain things about the client depending on the platform (mac loading screen)(windows loading screen)(linux loading screen) etc.. got kinda bored of making all the different login screens so i stopped half way through mac thought if anyone had any similar ideas they might appreciate this
    Alright, well I'm sure someone will have a use for it.




    [Only registered and activated users can see links. ]

    Spoiler for Eye Bleach & Recent Releases:



    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]


    Reply With Quote  
     

  7. #5  
    Registered Member DUGI's Avatar
    Join Date
    Jan 2013
    Age
    25
    Posts
    191
    Thanks given
    31
    Thanks received
    31
    Rep Power
    41
    Linux users start maxed out and with max cash.
    Reply With Quote  
     

  8. Thankful users:


  9. #6  
    Registered Member

    Join Date
    Dec 2012
    Posts
    3,006
    Thanks given
    899
    Thanks received
    929
    Rep Power
    2548
    That's a good idea tbh, you could make it so there is a little Windows icon for Windows users etc.
    Reply With Quote  
     

  10. #7  
    Respected Member

    Join Date
    Jan 2009
    Posts
    5,682
    Thanks given
    1,093
    Thanks received
    3,494
    Discord
    View profile
    Rep Power
    5000
    [Only registered and activated users can see links. ] looks familiar lol
    Reply With Quote  
     

  11. #8  
    Extreme Donator

    Jilic-Matt's Avatar
    Join Date
    May 2011
    Age
    26
    Posts
    1,614
    Thanks given
    799
    Thanks received
    495
    Rep Power
    540
    Quote Originally Posted by oobe View Post
    [Only registered and activated users can see links. ] looks familiar lol
    i take no credit for this got from a google search(couldnt remeber indexOf("), even though its not remotely difficult.
    #

    read please
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •