PDA

View Full Version : Differrent behaviour between interpreted and bundled script



dco045
25-01-2018, 20:57
Hello,
Still this French bother. :p

I encounter a curious behavior. A script run directly from ThinAir and the same "bundled".

I created a directory with spaces, underlines, minus signs. A real headache for a "parser".

The comptarg2.tbasic script in this directory behaves correctly.
The OS_command (1) only counts for one line: OK. See "screen_1"

The same "bundled" executable breaks this line by applying the separators.
See "screen2".

In "screen3", the same ".exe" is invoked by dragging and dropping two files from the directory on the bundled_exe. Their full pathes are not cut because, I think that "windows explorer" surrounds them with double quotes.
Don't you think that argument (1) should be treated as if it were surrounded by double quotes?

Best regards,


Dany

===================================================================


'---Load needed modules
Uses "Console"
Uses "OS"

Dim NumberOfCommands As Long
Dim Count As Long


Console_SetScreenBufferSize(132, 32)
Console_ShowWindow(%CONSOLE_SW_MAXIMIZE)

'---Some header

Console_Write("The following are the passed parameters (param 1 is always script name):" & $CRLF)
Console_Write(Repeat$(79, "-") & $CRLF)


'---Returns the number of commands specified
NumberOfCommands = OS_GetCommands

PrintL "OS_getcommands returned : " & NumberOfCommands
PrintL "separateurs par defaut : " & OS_CommandsGetSep

'---Show all parameters

For Count = 0 To NumberOfCommands

Console_Write( Format$(Count, "00") & " " & OS_GetCommand(Count) & $CRLF)

Next

Console_Write(Repeat$(79, "-") & $CRLF)


OS_CommandsSetSep ($DQ & "=-") ' No more [space] as separator
PrintL "separateurs modifies : " & OS_CommandsGetSep


For Count = 0 To NumberOfCommands

Console_Write( Format$(Count, "00") & " " & OS_GetCommand(Count) & $CRLF)

Next

WaitKey (30)

ErosOlmi
25-01-2018, 23:02
Thanks for reporting.
Command line arguments parsing differences between script and bundled exe has been my headache since ... a lot of time
grrrr