Skip to content

Commit

Permalink
Fixes issues with Cygwin
Browse files Browse the repository at this point in the history
Path of the profile and of the application.ini were not
in the good format.
there was also an issue with the --envs parameter.

Closes laurentj#4
  • Loading branch information
laurentj committed Jul 31, 2013
1 parent b711683 commit 899d086
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 197 deletions.
13 changes: 11 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@
Installation
============

SlimerJS runs on any platform on which Firefox or XulRunner is available. XulRunner
is the core of Firefox without its user interface.
Requirements
------------

SlimerJS runs on any platform on which Firefox or XulRunner is available: Linux (32bits and 64bits),
Windows, MacOs X. XulRunner is the core of Firefox without its user interface.

On windows, you should open a terminal. You can use the classical cmd.exe, or the recent PowerShell.exe.
You can also install `Cygwin <http://www.cygwin.com/>`_ and use its terminal.

You cannot use the MingW32 environment on Windows because there are some issues with
(no output in the console, and it lacks on some commands like mktemp).

Installation of SlimerJS
------------------------
Expand Down
3 changes: 1 addition & 2 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ Go to [http://slimerjs.org] to know more and to access to the documentation
- [Download the latest package](http://download.slimerjs.org/slimerjs-0.5RC1.zip) or
[the source code of SlimerJS](https://github.com/laurentj/slimerjs/archive/master.zip) if you didn't it yet
- On windows, a .bat is provided, but you can also launch slimer from a "true" console. In this case, you should install
[Cygwin](http://www.cygwin.com/) or any other unix environment to launch slimerjs. Note
that some issues are known with Cygwin.
[Cygwin](http://www.cygwin.com/) or any other unix environment to launch slimerjs.
- SlimerJS needs to know where Firefox or XulRunner is stored. It tries to discover
itself the path but can fail. You must then set the environment variable
SLIMERJSLAUNCHER, which should contain the full path to the firefox binary:
Expand Down
6 changes: 5 additions & 1 deletion src/components/commandline.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ slCommandLine.prototype = {
dump("error cache service:"+ ex+"\n");
}

slConfiguration.setEnvNames(cmdLine.handleFlagWithParam("envs", false).split(/,/));
if (envService.exists('__SLIMER_ENV')) {
let envs = envService.get('__SLIMER_ENV');
slConfiguration.setEnvNames(envs.split(/,/));
}

slConfiguration.workingDirectory = cmdLine.workingDirectory;

Expand Down Expand Up @@ -114,6 +117,7 @@ slCommandLine.prototype = {
}
}
else {

slConfiguration.scriptFile = cmdLine.resolveFile(slConfiguration.args[0]);
}
if (!slConfiguration.scriptFile.exists())
Expand Down
15 changes: 14 additions & 1 deletion src/slimerjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
done
SLIMERDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

SYSTEM=`uname -o`
if [ "$SYSTEM" == "Cygwin" ]
then
IN_CYGWIN=1
SLIMERDIR=`cygpath -w $SLIMERDIR`
else
IN_CYGWIN=
fi

# retrieve the path of a gecko launcher
if [ "$SLIMERJSLAUNCHER" == "" ]
then
Expand Down Expand Up @@ -136,6 +145,9 @@ then
echo "Error: cannot generate temp profile"
exit 1
fi
if [ "$IN_CYGWIN" == 1 ]; then
PROFILE_DIR=`cygpath -w $PROFILE_DIR`
fi
PROFILE="--profile $PROFILE_DIR"
else
PROFILE="-purgecaches"
Expand All @@ -144,9 +156,10 @@ fi
# put all arguments in a variable, to have original arguments before their transformation
# by Mozilla
export __SLIMER_ARGS="$@"
export __SLIMER_ENV="$LISTVAR"

# launch slimerjs with firefox/xulrunner
"$SLIMERJSLAUNCHER" -app $SLIMERDIR/application.ini $PROFILE -no-remote --envs "$LISTVAR" "$@"
"$SLIMERJSLAUNCHER" -app $SLIMERDIR/application.ini $PROFILE -no-remote "$@"

EXITCODE=$?

Expand Down
Loading

0 comments on commit 899d086

Please sign in to comment.