Menu

#864 Make groovy scripts that ship with Scripting Plugin cross-platform

3.0
closed-fixed
Yu Tang
5
2013-06-13
2013-05-17
No

Groovy scripts by Yu Tang, included in the recent version of the Scripting Plugin, are geared for Windows and need manual editing to be usable on other systems.
I suggest adding a little OS check in them to make them cross-platform.
It can be done (with my zero-knowledge of Java) with

System.getProperty("os.name");

So with an "if, then" check these scripts can behave according to the system they are run on.
In Linux opening files and folders can be done with "xdg-open" (regardless of DE), in OSX it's "open", I believe.

Discussion

  • Yu Tang

    Yu Tang - 2013-05-22

    Scripts are updated. Also I tried to write in more groovy way.
    I tested only under Windows 7.
    Anybody try them on Mac or/and Linux?

     
  • Didier Briel

    Didier Briel - 2013-05-22
    • status: open --> open-fixed
    • assigned_to: Yu Tang
     
  • Didier Briel

    Didier Briel - 2013-05-22

    I have committed the updated scripts to the Git repository.

    I won't publish the script plugin with the update, because it will be integrated in OmegaT anyway.

    Didier

     

    Last edit: Didier Briel 2013-05-22
  • Kos Ivantsov

    Kos Ivantsov - 2013-05-22

    In Linux using escaped quotes in command (like in --->command = "xdg-open \"folder\""<---, for instance) are passed literally, as a part of filename, and thus opening fails. Without quotes works as expected.
    If the project's path contains a space, the command fails with or without quotes. Although, when the path has spaces and escaped quotes are used, then xdg-open receives quotes as a part of the path, but the path is truncated right before the first space. For instance, if my project's folder is "/home/user/Documents/Urgent projects/EN-RU/May 20-26, 2013", xdg-open gives me this error:

    Unable to detect the URI-scheme of ""home/user/Documents/Urgent".

    (Two quotes at the beginning, one quote at the end, but I suspect the final quote got swallowed because of the space).

     
  • Kos Ivantsov

    Kos Ivantsov - 2013-05-22

    In previous version of the scripts any path could be open, no matter how many spaces there were.

     
  • Didier Briel

    Didier Briel - 2013-05-28
    • Group: future --> 3.0
     
  • Didier Briel

    Didier Briel - 2013-06-05

    The scripts were updated and should now work on all platforms.

    I have also updated them in the Git repository of the plugin (for 2.6).

    Didier

     
  • Didier Briel

    Didier Briel - 2013-06-13
    • status: open-fixed --> closed-fixed
     
  • Didier Briel

    Didier Briel - 2013-06-13

    Implemented in released version 3.0.3.

    Didier

     

Log in to post a comment.