[haiku-development] Re: Adding RDEFs to non-binary files

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 27 Feb 2015 09:38:05 +0100

On 27.02.2015 00:39, Augustin Cavalier wrote:
I'm trying to create a "javah" command that behaves like the "javaw"
command on Windows, so that when a user double-clicks a .jar file it
launches. I've created a shell script that does the job pretty well, and
a RDEF to go with it.

"javah" is already taken (by the JNI header/stub generator). And the purpose of javaw on Windows is actually just to start a non-console application (a problem that doesn't exist on Haiku). It has only indirectly to do with starting JARs on double click.

Anyway, a separate application -- a real application, not a script -- could do the trick of running a JAR. However, that is really only a solution for this situation. There are similar ones that have the same issue.

What is missing in Haiku is an option to associate a file type with a command line instead of a preferred application. For JAR files one would simply set "java -jar %f". This would also be a solution for all file types where the handling application would actually be a script.

However, how do I add the attributes from the RDEF to the shell script?
Xres corrups the file (obviously). I can copy a preexisting binary file
(e.g. cp), xres the compiled RDEF onto it, and then "copyattr" to the
shell script, but that's more a hack than a real solution...

The procedure is: 1. rc to resource file, 2. use resattr to add the resources as attributes. However, then you have the usual application attributes on a script, but I believe that doesn't help you with setting the script as a preferred application for a file type. I'm fairly sure BMimeType and/or BRoster check that the file is actually an application.

CU, Ingo


Other related posts: