Login  Register

Re: bug report: -batch command adds txt extension and macros directory automatically

Posted by Carnë Draug on Mar 14, 2014; 7:25pm
URL: http://imagej.273.s1.nabble.com/bug-report-batch-command-adds-txt-extension-and-macros-directory-automatically-tp5006916p5006928.html

On 14 March 2014 17:59, Johannes Schindelin <[hidden email]> wrote:

> Hi Carnë,
>
> On Fri, 14 Mar 2014, Carnë Draug wrote:
>
>> [...]
>>
>> The bigger problem, which if fixed would not break backwards
>> compatibility, is that after looking into the macros directory with a
>> file extension that was never defined,
>
> Please specify the exact file name, then, and do not let ImageJ guess what
> you want.

I am sorry if I am not being clear but that is exactly what I am
doing. I am specifying the exact file name so that ImageJ does not
have to make any guess. The macro file does *not* have a file
extension hence why I am passing ImageJ a filepath with *no* file
extension. But ImageJ seems to assume that if there is no file
extension it must be because I forgot it. So it looks for a file with
a file extension and then complains that it does not exist. The file
does exist, it simply has no file extension. I specifically said that
the file has no file extension by omitting it from the command. Is
there a syntax to specify no file extension?

I do not want ImageJ to guess, I want ImageJ to not guess. I specified
the exact and correct path. Why is it assuming that the path is
incorrect even before checking for it? I understand that if I'm making
things ambiguous by not specifying extension and leaving that up to
ImageJ, things can go wrong. But the argument I'm passing is correct
and unambiguous.

Why my macro files don't have a file extension? Because my macro files
are temporary and are being generated automatically on the run. The
creation and removal of the temporary file is being handled by other
libraries. What I am doing now, as a workaround this bug, is using "
'.' + filesep() + tempname" as filename to the system call.

Anyway, a solution to this while maintaining backwards compatibility:
after looking for files with the extension txt and ijm, look for the
actual file as defined in the input arguments.

> Further, I would *strongly* recommend using the file extension ".ijm"
> instead of ".txt". The latter is a well-established file extension
> denoting human-readable text, while ".ijm" is the recommended file
> extension for ImageJ macros for some years already. ImageJ 1.x' support to
> interpret ".txt" as macros' file extension is a historical wart of the
> same sort as criticised above; there is no need to make use of it.

Again, I apologise if I am being unclear. When I do write macros
myself, I use the ijm extension. What I pointed out was that the
current behaviour goes against what you just strongly recommended. The
current behaviour looks in the macro folder for files with txt and ijm
extension. If that fails, it looks into the current directory for a
file with the txt extension *only*. A file in the current directory
with the ijm extension (the one you strongly recommend) will be
ignored by ImageJ.

Carnë

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html