Startup scripts on Windows - how?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Startup scripts on Windows - how?

Frank Shearar-3
On a Linux machine, you can run a script from the command line thusly:
my/path/to/vm/squeak MyImage.image path/to/my/script.st. On Windows,
the analogous operation fails because (I think) CodeLoader doesn't
know how to handle file URIs like
'file:///C%3A/Users/frank/squeak-ci/target/update-image.st'.

Is this a known problem? How else can I run a startup script on
Windows? (Surely I'm not the only person in the world who wants to do
this?)

frank

Reply | Threaded
Open this post in threaded view
|

Re: Startup scripts on Windows - how?

Hannes Hirzel
Yes, some time ago I had the same problem but I did not follow up.

--Hannes

On 3/22/13, Frank Shearar <[hidden email]> wrote:

> On a Linux machine, you can run a script from the command line thusly:
> my/path/to/vm/squeak MyImage.image path/to/my/script.st. On Windows,
> the analogous operation fails because (I think) CodeLoader doesn't
> know how to handle file URIs like
> 'file:///C%3A/Users/frank/squeak-ci/target/update-image.st'.
>
> Is this a known problem? How else can I run a startup script on
> Windows? (Surely I'm not the only person in the world who wants to do
> this?)
>
> frank
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Startup scripts on Windows - how?

Bob Arning-2
In reply to this post by Frank Shearar-3
seems like URL is only one option...

            scriptName isEmpty ifFalse:[
                "figure out if script name is a URL by itself"
                isUrl := (scriptName asLowercase beginsWith:'<a class="moz-txt-link-freetext" href="http://">http://') or:[
                        (scriptName asLowercase beginsWith:'<a class="moz-txt-link-freetext" href="file://">file://') or:[
                        (scriptName asLowercase beginsWith:'<a class="moz-txt-link-freetext" href="ftp://">ftp://')]].
                isUrl ifFalse:[ | encodedPath pathTokens |
                    "Allow for ../dir/scriptName arguments"
                    pathTokens := scriptName splitBy: FileDirectory slash.
                    pathTokens := pathTokens collect: [:s | s encodeForHTTP].
                    encodedPath := pathTokens reduce: [:acc :each | acc , FileDirectory slash , each].
                    scriptName := (FileDirectory default uri
                        resolveRelativeURI: encodedPath) asString]].
        ]. ]

did you try a plain old file path?

On 3/22/13 7:53 AM, Frank Shearar wrote:
On a Linux machine, you can run a script from the command line thusly:
my/path/to/vm/squeak MyImage.image path/to/my/script.st. On Windows,
the analogous operation fails because (I think) CodeLoader doesn't
know how to handle file URIs like
'file:///C%3A/Users/frank/squeak-ci/target/update-image.st'.

Is this a known problem? How else can I run a startup script on
Windows? (Surely I'm not the only person in the world who wants to do
this?)

frank





Reply | Threaded
Open this post in threaded view
|

Re: Startup scripts on Windows - how?

Bob Arning-2
In reply to this post by Frank Shearar-3
I think maybe my first response was a bit off the mark. Can you provide the Windows command line? Was the file path absolute or relative? (I think absolute might work better).

Cheers,
Bob

On 3/22/13 7:53 AM, Frank Shearar wrote:
On a Linux machine, you can run a script from the command line thusly:
my/path/to/vm/squeak MyImage.image path/to/my/script.st. On Windows,
the analogous operation fails because (I think) CodeLoader doesn't
know how to handle file URIs like
'file:///C%3A/Users/frank/squeak-ci/target/update-image.st'.

Is this a known problem? How else can I run a startup script on
Windows? (Surely I'm not the only person in the world who wants to do
this?)

frank





Reply | Threaded
Open this post in threaded view
|

Re: Startup scripts on Windows - how?

Frank Shearar-3
In reply to this post by Bob Arning-2
OK, I think I know what's going on.

I have a directory C:\Users\frank\squeak-ci. In that I run rake,
kicking off a build. That runs the following shell command -
C:/Users/frank/squeak-ci/target/Squeak-4.10.2-2612-src-32/Squeak4.10.2-2612.exe
 "C:/Users/frank/squeak-ci/target/TrunkImage.image"
C:/Users/frank/squeak-ci/update-image.st - from within
C:\Users\frank\squeak-ci\target, a dumping ground for various build
artifacts.

If I instead use ../update-image.st as the startup script, everything
works correctly. So a full path to the script fails, while a relative
path works.

frank

On 22 March 2013 12:59, Bob Arning <[hidden email]> wrote:

> seems like URL is only one option...
>
>             scriptName isEmpty ifFalse:[
>                 "figure out if script name is a URL by itself"
>                 isUrl := (scriptName asLowercase beginsWith:'http://') or:[
>                         (scriptName asLowercase beginsWith:'file://') or:[
>                         (scriptName asLowercase beginsWith:'ftp://')]].
>                 isUrl ifFalse:[ | encodedPath pathTokens |
>                     "Allow for ../dir/scriptName arguments"
>                     pathTokens := scriptName splitBy: FileDirectory slash.
>                     pathTokens := pathTokens collect: [:s | s
> encodeForHTTP].
>                     encodedPath := pathTokens reduce: [:acc :each | acc ,
> FileDirectory slash , each].
>                     scriptName := (FileDirectory default uri
>                         resolveRelativeURI: encodedPath) asString]].
>         ]. ]
>
> did you try a plain old file path?
>
> On 3/22/13 7:53 AM, Frank Shearar wrote:
>
> On a Linux machine, you can run a script from the command line thusly:
> my/path/to/vm/squeak MyImage.image path/to/my/script.st. On Windows,
> the analogous operation fails because (I think) CodeLoader doesn't
> know how to handle file URIs like
> 'file:///C%3A/Users/frank/squeak-ci/target/update-image.st'.
>
> Is this a known problem? How else can I run a startup script on
> Windows? (Surely I'm not the only person in the world who wants to do
> this?)
>
> frank

Reply | Threaded
Open this post in threaded view
|

Re: Startup scripts on Windows - how?

Frank Shearar-3
I'm scratched my itch for the moment, making my build tools
"relativise" the path to the script. I think it's still a bug that I
can't refer to a script via a full path, and raised
http://bugs.squeak.org/view.php?id=7732.

frank

On 22 March 2013 13:17, Frank Shearar <[hidden email]> wrote:

> OK, I think I know what's going on.
>
> I have a directory C:\Users\frank\squeak-ci. In that I run rake,
> kicking off a build. That runs the following shell command -
> C:/Users/frank/squeak-ci/target/Squeak-4.10.2-2612-src-32/Squeak4.10.2-2612.exe
>  "C:/Users/frank/squeak-ci/target/TrunkImage.image"
> C:/Users/frank/squeak-ci/update-image.st - from within
> C:\Users\frank\squeak-ci\target, a dumping ground for various build
> artifacts.
>
> If I instead use ../update-image.st as the startup script, everything
> works correctly. So a full path to the script fails, while a relative
> path works.
>
> frank
>
> On 22 March 2013 12:59, Bob Arning <[hidden email]> wrote:
>> seems like URL is only one option...
>>
>>             scriptName isEmpty ifFalse:[
>>                 "figure out if script name is a URL by itself"
>>                 isUrl := (scriptName asLowercase beginsWith:'http://') or:[
>>                         (scriptName asLowercase beginsWith:'file://') or:[
>>                         (scriptName asLowercase beginsWith:'ftp://')]].
>>                 isUrl ifFalse:[ | encodedPath pathTokens |
>>                     "Allow for ../dir/scriptName arguments"
>>                     pathTokens := scriptName splitBy: FileDirectory slash.
>>                     pathTokens := pathTokens collect: [:s | s
>> encodeForHTTP].
>>                     encodedPath := pathTokens reduce: [:acc :each | acc ,
>> FileDirectory slash , each].
>>                     scriptName := (FileDirectory default uri
>>                         resolveRelativeURI: encodedPath) asString]].
>>         ]. ]
>>
>> did you try a plain old file path?
>>
>> On 3/22/13 7:53 AM, Frank Shearar wrote:
>>
>> On a Linux machine, you can run a script from the command line thusly:
>> my/path/to/vm/squeak MyImage.image path/to/my/script.st. On Windows,
>> the analogous operation fails because (I think) CodeLoader doesn't
>> know how to handle file URIs like
>> 'file:///C%3A/Users/frank/squeak-ci/target/update-image.st'.
>>
>> Is this a known problem? How else can I run a startup script on
>> Windows? (Surely I'm not the only person in the world who wants to do
>> this?)
>>
>> frank

Reply | Threaded
Open this post in threaded view
|

Re: Startup scripts on Windows - how?

Bob Arning-2
Not that I really need to know, but are those mixed forward and backward slashes ok? I thought you used one or the other depending on OS.

On 3/22/13 10:20 AM, Frank Shearar wrote:
I'm scratched my itch for the moment, making my build tools
"relativise" the path to the script. I think it's still a bug that I
can't refer to a script via a full path, and raised
http://bugs.squeak.org/view.php?id=7732.

frank

On 22 March 2013 13:17, Frank Shearar [hidden email] wrote:
OK, I think I know what's going on.

I have a directory C:\Users\frank\squeak-ci. In that I run rake,
kicking off a build. That runs the following shell command -
C:/Users/frank/squeak-ci/target/Squeak-4.10.2-2612-src-32/Squeak4.10.2-2612.exe
 "C:/Users/frank/squeak-ci/target/TrunkImage.image"
C:/Users/frank/squeak-ci/update-image.st - from within
C:\Users\frank\squeak-ci\target, a dumping ground for various build
artifacts.

If I instead use ../update-image.st as the startup script, everything
works correctly. So a full path to the script fails, while a relative
path works.

frank

On 22 March 2013 12:59, Bob Arning [hidden email] wrote:
seems like URL is only one option...

            scriptName isEmpty ifFalse:[
                "figure out if script name is a URL by itself"
                isUrl := (scriptName asLowercase beginsWith:'<a class="moz-txt-link-freetext" href="http://">http://') or:[
                        (scriptName asLowercase beginsWith:'<a class="moz-txt-link-freetext" href="file://">file://') or:[
                        (scriptName asLowercase beginsWith:'<a class="moz-txt-link-freetext" href="ftp://">ftp://')]].
                isUrl ifFalse:[ | encodedPath pathTokens |
                    "Allow for ../dir/scriptName arguments"
                    pathTokens := scriptName splitBy: FileDirectory slash.
                    pathTokens := pathTokens collect: [:s | s
encodeForHTTP].
                    encodedPath := pathTokens reduce: [:acc :each | acc ,
FileDirectory slash , each].
                    scriptName := (FileDirectory default uri
                        resolveRelativeURI: encodedPath) asString]].
        ]. ]

did you try a plain old file path?

On 3/22/13 7:53 AM, Frank Shearar wrote:

On a Linux machine, you can run a script from the command line thusly:
my/path/to/vm/squeak MyImage.image path/to/my/script.st. On Windows,
the analogous operation fails because (I think) CodeLoader doesn't
know how to handle file URIs like
'file:///C%3A/Users/frank/squeak-ci/target/update-image.st'.

Is this a known problem? How else can I run a startup script on
Windows? (Surely I'm not the only person in the world who wants to do
this?)

frank




Reply | Threaded
Open this post in threaded view
|

Re: Startup scripts on Windows - how?

Frank Shearar-3
When you see the \s it's because I typed them on the command line.
When you see /s it's because Ruby prints out everything that way. But
with cygwin installed you can mix & match \s and /s (although
autocompleting paths breaks completely).

But otherwise, yes, you're right.

frank

On 22 March 2013 14:39, Bob Arning <[hidden email]> wrote:

> Not that I really need to know, but are those mixed forward and backward
> slashes ok? I thought you used one or the other depending on OS.
>
> On 3/22/13 10:20 AM, Frank Shearar wrote:
>
> I'm scratched my itch for the moment, making my build tools
> "relativise" the path to the script. I think it's still a bug that I
> can't refer to a script via a full path, and raised
> http://bugs.squeak.org/view.php?id=7732.
>
> frank
>
> On 22 March 2013 13:17, Frank Shearar <[hidden email]> wrote:
>
> OK, I think I know what's going on.
>
> I have a directory C:\Users\frank\squeak-ci. In that I run rake,
> kicking off a build. That runs the following shell command -
> C:/Users/frank/squeak-ci/target/Squeak-4.10.2-2612-src-32/Squeak4.10.2-2612.exe
>  "C:/Users/frank/squeak-ci/target/TrunkImage.image"
> C:/Users/frank/squeak-ci/update-image.st - from within
> C:\Users\frank\squeak-ci\target, a dumping ground for various build
> artifacts.
>
> If I instead use ../update-image.st as the startup script, everything
> works correctly. So a full path to the script fails, while a relative
> path works.
>
> frank
>
> On 22 March 2013 12:59, Bob Arning <[hidden email]> wrote:
>
> seems like URL is only one option...
>
>             scriptName isEmpty ifFalse:[
>                 "figure out if script name is a URL by itself"
>                 isUrl := (scriptName asLowercase beginsWith:'http://') or:[
>                         (scriptName asLowercase beginsWith:'file://') or:[
>                         (scriptName asLowercase beginsWith:'ftp://')]].
>                 isUrl ifFalse:[ | encodedPath pathTokens |
>                     "Allow for ../dir/scriptName arguments"
>                     pathTokens := scriptName splitBy: FileDirectory slash.
>                     pathTokens := pathTokens collect: [:s | s
> encodeForHTTP].
>                     encodedPath := pathTokens reduce: [:acc :each | acc ,
> FileDirectory slash , each].
>                     scriptName := (FileDirectory default uri
>                         resolveRelativeURI: encodedPath) asString]].
>         ]. ]
>
> did you try a plain old file path?
>
> On 3/22/13 7:53 AM, Frank Shearar wrote:
>
> On a Linux machine, you can run a script from the command line thusly:
> my/path/to/vm/squeak MyImage.image path/to/my/script.st. On Windows,
> the analogous operation fails because (I think) CodeLoader doesn't
> know how to handle file URIs like
> 'file:///C%3A/Users/frank/squeak-ci/target/update-image.st'.
>
> Is this a known problem? How else can I run a startup script on
> Windows? (Surely I'm not the only person in the world who wants to do
> this?)
>
> frank
>
>
>
>
>