Platform.getOS() on FreeBSD

View: New views
3 Messages — Rating Filter:   Alert me  

Platform.getOS() on FreeBSD

by Boris Hollas-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I had big trouble running the OcaIDE plugin on FreeBSD 7.2 with Eclipse  
3.4.1 from ports until I discovered these lines in the plugin source

public static boolean runningOnLinuxCompatibleSystem() {
String os = Platform.getOS();
return (os.equals(Platform.OS_LINUX) || os.equals(Platform.OS_MACOSX));
}

and replaced them with

public static boolean runningOnLinuxCompatibleSystem() {
String os = Platform.getOS();
return (os.equals(Platform.OS_LINUX) || os.equals(Platform.OS_MACOSX) ||  
os.equals(Platform.OS_FREEBSD));
}

(see http://ocaml.eclipse.free.fr/forum/viewtopic.php?f=3&t=216).

Now everything seems to work.

My questions:
- Does Platform.OS_FREEBSD return Platform.getOS() only in the Eclipse  
version created by the FreeBSD-Eclipse team
   or is this built into Eclipse by default?
- If the former is true, is os.equals(Platform.OS_FREEBSD) portable code  
or will it produce a compiler error on non-FreeBSD systems?
- Do the Eclipse developers know about the problem?
- What should I suggest to the OcaIDE developers to ensure portability of  
the plugin's code?

Best regards,
Boris
_______________________________________________
freebsd-eclipse@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-eclipse
To unsubscribe, send any mail to "freebsd-eclipse-unsubscribe@..."

Re: Platform.getOS() on FreeBSD

by Rick C. Petty-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Aug 13, 2009 at 07:47:50PM +0200, Boris Hollas wrote:
>
> (see http://ocaml.eclipse.free.fr/forum/viewtopic.php?f=3&t=216).
>
> Now everything seems to work.
>
> My questions:
> - Does Platform.OS_FREEBSD return Platform.getOS() only in the Eclipse  
> version created by the FreeBSD-Eclipse team
>   or is this built into Eclipse by default?

I'll assume you mean:  Does Platform.getOS() return Platform.OS_FREEBSD
in which case I suspect so.

> - If the former is true, is os.equals(Platform.OS_FREEBSD) portable code  
> or will it produce a compiler error on non-FreeBSD systems?

Probably not, since FreeBSD's port patches
/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java
to add OS_FREEBSD.

> - Do the Eclipse developers know about the problem?

Probably not.  We should try to push our patches upstream, but no one seems
to have time to do so.

> - What should I suggest to the OcaIDE developers to ensure portability of  
> the plugin's code?

Use reflection-- check if the field Platform.OS_FREEBSD exists, *or* scan
through what Platform.knownOSValues() returns for the string "freebsd".

-- Rick C. Petty
_______________________________________________
freebsd-eclipse@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-eclipse
To unsubscribe, send any mail to "freebsd-eclipse-unsubscribe@..."

Re: Platform.getOS() on FreeBSD

by Stephane E. Potvin-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Boris Hollas wrote:

> Hi,
>
> I had big trouble running the OcaIDE plugin on FreeBSD 7.2 with Eclipse
> 3.4.1 from ports until I discovered these lines in the plugin source
>
> public static boolean runningOnLinuxCompatibleSystem() {
> String os = Platform.getOS();
> return (os.equals(Platform.OS_LINUX) || os.equals(Platform.OS_MACOSX));
> }
>
> and replaced them with
>
> public static boolean runningOnLinuxCompatibleSystem() {
> String os = Platform.getOS();
> return (os.equals(Platform.OS_LINUX) || os.equals(Platform.OS_MACOSX) ||
> os.equals(Platform.OS_FREEBSD));
> }
>
> (see http://ocaml.eclipse.free.fr/forum/viewtopic.php?f=3&t=216).
>
> Now everything seems to work.
>
> My questions:
> - Does Platform.OS_FREEBSD return Platform.getOS() only in the Eclipse
> version created by the FreeBSD-Eclipse team
>   or is this built into Eclipse by default?
> - If the former is true, is os.equals(Platform.OS_FREEBSD) portable code
> or will it produce a compiler error on non-FreeBSD systems?
> - Do the Eclipse developers know about the problem?
> - What should I suggest to the OcaIDE developers to ensure portability
> of the plugin's code?
>

Hi Boris,

- - Platform.OS_FREEBSD is defined only on the FreeBSD version of Eclipse available from the ports tree, it is not built into the
default eclipse distribution so it can't safely be used by plugins outside of the ports tree at this time.
- - I don't expect a lot of people in the Eclipse community to be aware of this issue (but I would be agreeably surprised if I was to
be proven wrong). There were tentative in the past to get FreeBSD support within Eclipse without success. I still hope to be able to
do something about that in the future but there are yet issues I must fix before I'll try to bug the Eclipse releng team.
- - As for OcaIDE, they could turn the test around and check if they were not running on a windows compatible system. You'll have to
discuss that with them as it might or not apply to what they're trying to achieve.

Hope this helps.

Steph

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqEZx0ACgkQmdOXtTCX/ns02ACgjKTUOZz1H86acJtBqRvuFMV1
JJEAnA2EGQ9ajEfv1RqpMhPqyVVzsTmJ
=DROS
-----END PGP SIGNATURE-----

_______________________________________________
freebsd-eclipse@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-eclipse
To unsubscribe, send any mail to "freebsd-eclipse-unsubscribe@..."