Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Famix Maker fails when VerveineJ is in a path with spaces #5

Open
fuhrmanator opened this issue Jul 31, 2019 · 2 comments
Open

Famix Maker fails when VerveineJ is in a path with spaces #5

fuhrmanator opened this issue Jul 31, 2019 · 2 comments

Comments

@fuhrmanator
Copy link
Collaborator

fuhrmanator commented Jul 31, 2019

I suspect the verveinej.sh script doesn't handle well the CLASSPATH when there are spaces, but more investigation is needed.

The image I was using was in WSL at ~/Pharo/images/Moose Suite 8.0 (development version)

@fuhrmanator
Copy link
Collaborator Author

Maybe use environment variables defined in Pharo before the LibC call, to pass the output file for verveinej.sh. Escaping spaces in the output path (MSE file) is difficult when it goes to a script and is massaged later.

@fuhrmanator
Copy link
Collaborator Author

fuhrmanator commented Aug 2, 2019

@NicolasAnquetil Here's a script that works, but I didn't test it from Windows yet. The trouble is that as soon as you assign any of the $@ elements to a variable, the quoting (to preserve spaces) breaks. Maybe there's a better way, but this way works.

#!/usr/bin/env bash
# find the location of the "--" argument
((ddashloc=0))
((i=0))
for f in "$@"; do
  ((i++))
  #echo "$f";
  if [ "$f" == "--" ]
  then
    ((ddashloc= $i+1))
  fi
done

# Directory for verveine source
BASELIB=`dirname "$0"`/lib

# on windows, convert backslashes to slashes so that file expansion will work
BASELIB=$(sed 's:\\:/:g' <<< "$BASELIB")

pathsep=":"
# handle path separator for flavors of windows (MINGW in LibC via Pharo)
case $(uname) in
MINGW*|CYGWIN*)
  pathsep=";"
esac
for i in "$BASELIB"/*.jar; do
    CLASSPATH="$CLASSPATH"$pathsep"$i"
done
CLASSPATH=`echo $CLASSPATH | cut -c2-`

# without the special "--" argument, all options are assumed to be for Verveine
if [ $ddashloc != 0 ]
then
  java ${@:1:(($ddashloc-2))} -cp "$CLASSPATH" fr.inria.verveine.extractor.java.VerveineJParser "${@:$ddashloc}"
else
  java -cp "$CLASSPATH" fr.inria.verveine.extractor.java.VerveineJParser "${@:1}"
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant