SAMP on Windows

Mark Taylor m.b.taylor at bristol.ac.uk
Thu May 15 03:03:27 PDT 2008


On Wed, 14 May 2008, Thomas Boch wrote:

>> Is it worth noting this issue (and perhaps providing a snippet of
>> java boilerplate for how to locate the home directory) in the
>> Standard Profile section of the document, or would that be cluttering
>> it too much with language-dependent details?
>
> Maybe we could briefly note the issue and give a link to a detailed
> explanation and possible remedy ?

Yes, that's probably the right approach.  For now I've written the
following:

    Hub discovery is performed by examining a lockfile in a well-known location.
    This has the consequence that in normal operation each user may run
    only one hub, and users do not share hubs.  The name of the lockfile
    is ``{\tt .samp}'' in the user's home directory.
    A ``home directory'' is a somewhat system-dependent concept:
    we define it as the value of the {\tt \$HOME} environment variable on
    Unix-like systems and as the value of the {\tt \%USERPROFILE\%} environment
    variable on Microsoft Windows\footnote{
       Note to Java developers: contrary to what you might expect,
       the {\tt user.home} system property on Windows does {\em not} give you the
       value of {\tt USERPROFILE}.
       See http://bugs.sun.com/bugdatabase/view\_bug.do?bug\_id=4787931.
    }.

Maybe once there is a java reference implementation we can point at that
for boilerplate code to find the home directory.

> Another (ugly) solution would be to do a system call to retrieve this
> value :
> String[] cmd = {"cmd", "/c", "echo", "%USERPROFILE%"};
> Process p = Runtime.getRuntime().exec(cmd, null);
> ...

I hadn't thought of that.  If this works it might be worth adding it
to the Sun bug report referenced above - sounds like it could sort 
out some people's non-SAMP-related woes as well.

Mark

-- 
Mark Taylor   Astronomical Programmer   Physics, Bristol University, UK
m.b.taylor at bris.ac.uk +44-117-928-8776 http://www.star.bris.ac.uk/~mbt/



More information about the apps-samp mailing list