Uwe Stöhr wrote:


I used now the following code to assure that it will also work on Lunix:

---
# Search something to view LaTeX-files
echo $ac_n "checking for an editor to view LaTeX-files""... $ac_c"
echo "$ac_t""(jEdit PSPad WinShell ConTEXT Crimson Editor Vim TeXnicCenter LaTeXEditor WinEdt LEd WinTeX Notepad)"
TEX_VIEWER=
for ac_prog in jedit.jar pspad winshell context cedt gvim texcntr latexeditor winedt led wintex notepad
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog ; ac_word=$2
if test -n "$ac_word"; then
  echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
  IFS="${IFS=    }"; ac_save_ifs="$IFS"; IFS=":"
  for ac_dir in $PATH; do
    test -z "$ac_dir" && ac_dir=.
    if test -x $ac_dir/$ac_word; then
      TEX_VIEWER="$ac_prog"
      break
    fi
  done
  IFS="$ac_save_ifs"

  if test -n "$TEX_VIEWER"; then
    ac_result=yes

  else
    ac_result=no
  fi
  echo "$ac_t""$ac_result"
  test -n "$TEX_VIEWER" && break
fi
done

if test -z "$TEX_VIEWER" ; then
  TEX_VIEWER=none
fi
---

regards Uwe


Uwe,

I'm not sure what's going on here, but I think I have a partial answer. I tested your previous script on an XP Pro box in my office, and it was able to detect jedit.jar stored in C:\temp (with C:\temp added to the Windows path). I just tested your current script (which is substantively the same) on a different XP Pro box, again putting jedit.jar in C:\temp and putting C:\temp on the command path, and this time the script did not find jedit.jar (but, as you said, does find jedit.exe in the same directory).

I'm not sure why it worked on the first machine, but I think the problem has to do with whether sh thinks that jar files are executable. If you change

    if test -x $ac_dir/$ac_word; then

to

    if test -r $ac_dir/$ac_word; then

the script then finds jedit.jar. Note that test -r looks for a file you can read, whereas test -x looks for a file you can execute.

I ran sh -c "ls -l /c/temp" and got the following:

-rwxrwxrwx    1 rubin    0           10708 Oct 16 18:34 jedit.exe
-rw-rw-rw-    1 rubin    0           10708 Feb  4 18:33 jedit.jar

Note that jedit.exe is flagged executable (x bit) but jedit.jar is not.

I suspect you may have to live with test -r, or else split the code and use test -r for jar files and test -x for executables. There may be some virtue to the latter, since it at least confirms that the user has permissions to run the exe files. (This raises another question: should you test for existence of java.exe or javaw.exe, with user execute permissions, or just assume that if someone has a jar file they'll have a working Java interpreter?)

Hope this helps,

/Paul

Reply via email to