[argyllcms] Re: Argyll GUI

  • From: "Hal V. Engel" <hvengel@xxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Thu, 7 Aug 2008 14:43:59 -0700

On Thursday 07 August 2008 02:24:04 pm Frédéric wrote:
> On jeudi 07 août 2008, Klaus Karcher wrote:
> > I had no success building ArgyllCMSGUI for MacOS 10.5/Intel. Anyone
> > else?
>
> I successfully build it under linux (Steve sent me a new version). But
> there are still problems, because it searches for .exe argyll binaries :o/

The code probabloy needs to do something like this:

# ifdef __WIN32__
     char pathSep = ';';
     const QString iccExamin = "iccexamin.exe";
#elif defined (__APPLE__)
     QChar pathSep = ':';
     const QString iccExamin ="iccexamin.app/Contents/MacOS/iccexamin";
# else
     char pathSep = ':';  
     const QString iccExamin = "iccexamin";
# endif /* __WIN32__ */

// then search the path to see if iccExaminPath is found.

QString Path = getenv("PATH");
QFileInfo fileinfo;

bool done = false;
bool found = false;

while (!done)
{
    if (!Path.length() > 0) // still more paths to look at
                 done=true;
          else
          {
              // get next path
              iccExaminPath = Path.left(Path.indexOf(pathSep, 0, 
Qt::CaseSensitive)) + "/" + iccExamin ;
              // remove the path we are about to check from path
              Path = Path.right(Path.length() - Path.indexOf(pathSep, 0, 
Qt::CaseSensitive) - 1);

              fileinfo.setFile(iccExaminPath);

              // check to see if it exists
             if (fileinfo.exists())
             {  
                 done = true;
                 found = true;
            }
             // check to see if this was last path
             if (Path.length() <= iccExaminPath.length())
                 done = true;
           }
}

if (found) // then we have found the exeutable.

Although the above code is for locating a different program and has some Qt 
centric code the basic logic should work for any executable.

Hal

Other related posts: