locations of glue.exe and called.js; and "net" HTTPRequestHandler() response.sendFile('s) path

14 views
Skip to first unread message

PaulANormanNZ

unread,
Oct 8, 2011, 5:11:27 AM10/8/11
to glues...@googlegroups.com
Hi,

As argv[0] refers to the first passed parameter and not binary or script location,

1. in GLUEscript.chm, under Configuration, mention is made of ${application.dir} available in glue.properties, is this or similar available to script at run time please?

2. And also can the path of the script called/started by glue be determined at run time at all?

At the moment to get the script's path under Windows I am using a batch file to call glue and passing the location of the batch file (which is in the same directory as the .js glue is calling)

Form batch file, I am setting %here% (have to use the following order of start(s)  so that  --keepRunning doesn't interfere with launching Chrome - timing always seems to work so far) ...

@echo off
set here=%~dp0

cd ../../../bin

start "C:\Documents and Settings\Paul A Norman\Local Settings\Application Data\Google\Chrome SxS\Application\chrome.exe" "http://localhost:50001/?action=html&url=buildListofImages.html"

start cmd /c glue --keepRunning ..\projects\modules\buildListofIImages\btabb_httpserver.js "%here%

exit

3. Open quote needed in "%here%   in case of spaces,  otherwise if I use a closing " as in "%here%" the final " is also included in what is passed in as argv[0].

And then in the script ...

var mainRoot = argv[0] ;
var documentRoot = mainRoot + 'html\\' ;

This is particularly needed it seems when using the glue "net" for setting a document root  for situations like...

var handler = new net.HTTPRequestHandler();
                                 handler.handleRequest = function(request, response)
//...
response.sendFile(thisFile, mimeType);

4. thisFile seems to need to be a fully resolved path?

Paul
Reply all
Reply to author
Forward
0 new messages