ai-karanam / leptonica

Automatically exported from code.google.com/p/leptonica
0 stars 0 forks source link

gthumb won't work under Windows #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try adaptmaptest.c.

What is the expected output? What do you see instead?
I expect to see all the junk_write_display* files I think.
Nothing.

What version of the product are you using? On what operating system?
leptonlib-1.63.
Microsoft Visual Studio 2008 SP1 with latest updates also applied.
Windows XP Pro SP3.

Please provide any additional information below.
Unfortunately, all prog programs that do something like:
    system("gthumb junk_write_display* &");

will have to be changed to something like this to work under Windows:    

    pixDisplayMultipleImages("junk_write_display*");

where pixDisplayMultipleImages() is something like:

/*!
 *  pixDisplayMultipleImages()
 *
 *      Input:  filepattern
 *      Return: 0 if OK; 1 on error
 */
l_int32
pixDisplayMultipleImages(const char  *filepattern)
{
char            buffer[L_BUF_SIZE];
#ifdef WIN32
char        pathname[MAX_PATH];
char        *dir;
char            *tail;
#endif

    PROCNAME("pixDisplayMultiple");

    if (!filepattern || strlen(filepattern) == 0)
        return ERROR_INT("filepattern not defined", procName, 1);

#ifndef COMPILER_MSVC
    snprintf(buffer, L_BUF_SIZE, "gthumb %s &", filepattern);
    system(buffer);
#else
    // irFanView wants absolute path for directory
    _fullpath(pathname, filepattern, sizeof(pathname));
    splitPathAtDirectory(pathname, &dir, &tail);

    snprintf(buffer, L_BUF_SIZE,
             "i_view32.exe \"%s\" /filepattern=\"%s\" /thumbs",
         dir, tail);
    system(buffer);
    FREE(dir);
    FREE(tail);
#endif

    return 0;
}

(As it turns out _fullpath will automatically change / to \ if necessary so
this should still work even if filepattern contains the wrong style pathsep
chars.)

Original issue reported on code.google.com by tomp2...@gmail.com on 4 Dec 2009 at 11:43

GoogleCodeExporter commented 9 years ago
Thank you.  Very good suggestion!

This is now in writefile.c (attached) and will be in 1.64.

Still to do: upgrade all the programs that explicitly call gthumb.
All files will be written to /tmp, rather than the current directory.
These changes will be incorporated into 1.64.

Original comment by dan.bloo...@gmail.com on 6 Dec 2009 at 8:06

Attachments:

GoogleCodeExporter commented 9 years ago
fixed in 1.64

Original comment by dan.bloo...@gmail.com on 3 Jan 2010 at 11:40