ontodev / robot

ROBOT is an OBO Tool
http://robot.obolibrary.org
BSD 3-Clause "New" or "Revised" License
264 stars 74 forks source link

Typo in command to create robot.bat file #1140

Closed jseager7 closed 1 year ago

jseager7 commented 1 year ago

There seems to be a typo in the command to create the robot.bat batch file on the ROBOT Getting Started page:

"java %ROBOT_JAVA_ARGS% -jar %~dr0robot.jar %*" | out-file robot.bat -encoding utf8

%~dr0 doesn't seem to be a valid argument expansion syntax. I think this should be %~dp0%, based on the batch script file and the help for the CALL command:

        %~dp1       - expands %1 to a drive letter and path only

Furthermore, the command only seems to work in Windows PowerShell (not Command Prompt), which the guide doesn't specify.

Also, in older versions of PowerShell (version 6 and below), the utf8 encoding still inserts a byte-order mark (BOM), which breaks the command even after the typo is corrected (see here).

C:\Users\user\robot>´╗┐java  -jar C:\Users\user\robot\robot.jar
'´╗┐java' is not recognized as an internal or external command,
operable program or batch file.

The documentation should probably specify that a specific version of PowerShell is required to create the batch file using the command.

matentzn commented 1 year ago

@jseager7 would you be willing to

  1. Make a PR to fix this issue here: https://github.com/ontodev/robot/blob/master/bin/robot.bat
  2. see if you can get the bat file to work for both CMD and powershell

We are a bit strapped for resources, but I would be happy to review a PR and find a few people to test it.

jseager7 commented 1 year ago

@matentzn Just to clarify, the bat file checked into the repository has no problems, so downloading that file (as the documentation suggests as the first option) works fine. It's the command in the documentation to generate a bat file that's the problem, because it generates a non-functional bat file.

I'm happy to open a PR to fix the typo in the command. Task 2 might be trickier since different commands to generate the bat file will likely be required for Command Prompt and PowerShell. The simplest fix would be to clarify that the command requires PowerShell version 6 or later, which hopefully won't be a big problem since running the command to generate a bat file is a fallback option anyway.

matentzn commented 1 year ago

Sounds good! If you want to do 1) and just add a sentence to the docs about powershell..