AppArgs problem

BlitzMax Forums/BlitzMax Programming/AppArgs problem

William Drescher(Posted 2008) [#1]
I'm not exactly sure if this is a bug for the bugs section but I'll give it a shot here.

For some odd reason, my AppArgs$[] global is returning the AppFile$ global along with the command line I enter in and dropping out the last argument i enter. Has anyone else had this problem and does anyone know how to fix this?


GfK(Posted 2008) [#2]
Not sure what you're saying.

My tests give expected results, running my app "v.exe" with flags "-a -b -c":

Local f:TStream = WriteFile("out.txt")

For a$ = EachIn AppArgs
	WriteLine f,a$
Next
CloseFile f


C:\Users\Admin\Desktop\New Folder\v.debug.exe
-a
-b
-c




Brucey(Posted 2008) [#3]
Isn't the first param [0] meant to be the app name?


plash(Posted 2008) [#4]
Isn't the first param [0] meant to be the app name?
Noope, somewhere in the docs it mentions the app path is ALWAYS going to be the first element in appargs.


Brucey(Posted 2008) [#5]
App path/app name... same difference :-)


William Drescher(Posted 2008) [#6]
Mine gives this (with GfK's code):


D:\Blitz\Blitz MAX\Projects\file.exe
D:\Blitz\Blitz MAX\Projects\file.exe
-a
-b



It's dropping the last AppArg parameter and I supposed it was from the first argument but maybe I'm wrong. (Sorry if I wasn't very clear with the first post, I'll edit it.)


degac(Posted 2008) [#7]
Interesting


D:/_BlitzMax/test_cli.exe
-a
-b
-c



If I run the application from the IDE [with Command Line -a -b -c]
while if I run from CLI (so I move to the folder where the app is) I get the following...

test_cli -a -b -c


test_cli
-a
-b
-c



BlitzMax 1.30 SVN Rev.147, debug off, no threaded

There is a slightly difference in the first parameter: Path and APP_NAME are not the same thing....

edit
Just read better the documentation and

The AppArgs global array contains the command line parameters sent to an application when it was started. The first element of AppArgs always contains the name of the application. However, the format of the name may change depending on how the application was launched. Use AppDir or AppFile for consistent information about the applications name or directory.




plash(Posted 2008) [#8]
Hmm why would it be setting the AppPath twice... Are you using modified official mods, Wilkua?