NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 345 - Fiji can not be launched as usual anymore
Fiji can not be launched as usual anymore
Status: CLOSED WORKSFORME
Product: ImageJ
Classification: Unclassified
Component: Launcher
unspecified
PC Windows
: P2 major
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2011-08-09 16:53 CDT by Sebastian Rhode
Modified: 2015-04-06 15:44 CDT
0 users

See Also:

Description Sebastian Rhode 2011-08-09 16:53:51 CDT
Hi,

we used to start Fiji from within our LA Software from the command line. This worked fine, but recently something within Fiji changed.
Now it requires the ".exe" extension somehow.  Since I am not the expert, I askes one of our programmers, and here is what he answered: (I hope that helps)


 The problem seems to be that you can start Fiji without using the .exe extension, however, you then can't use the name provided by argv[0] in functions like GetShortPathName since the file fiji-win32 actually doesn't exist.
 
new_argv[0] = dos_path(new_argv[0]);
 
for (i = 0; i < j; i++)
    new_argv[i] = quote_win32(new_argv[i]);
    execve(new_argv[0], (char * const *)new_argv, NULL);
 
[...]
 
static char *dos_path(const char *path)
{
    int size = GetShortPathName(path, NULL, 0);
    char *buffer = (char *)xmalloc(size);
    GetShortPathName(path, buffer, size);
    return buffer;
}
 
 
 
Here is a small test case to demonstrate the problem:
 
fiji1.cpp:
 
#include <Windows.h>
 
int main(int argc, char* argv[])
{
    int size = GetShortPathName(argv[0], NULL, 0);
    char *buffer = (char *)calloc(size, 1);
    GetShortPathName(argv[0], buffer, size);
 
    printf("GetShortPathName: %s GetLastError: 0x%08X\n", buffer, GetLastError());
}
 
 
$ fiji1.exe
GetShortPathName: fiji1.exe GetLastError: 0x00000000
 
$ fiji1
GetShortPathName: ²²²² GetLastError: 0x00000002
Comment 1 Johannes Schindelin 2011-10-20 02:06:19 CDT
No matter what I do, I can still start Fiji from the command-line just fine, even when calling without the ".exe" extension. What do I do wrong?

I use both cmd and the Git Bash to call Fiji, both in the same directory and with the absolute path.
Comment 2 Johannes Schindelin 2012-02-20 20:00:08 CST
I finally could reproduce the issue. It took an XP machine to do so, that was not clear for me.

After an update, the issue should be gone.