Re: Passing non-string user defaults through command line arguments
Re: Passing non-string user defaults through command line arguments
- Subject: Re: Passing non-string user defaults through command line arguments
- From: Christiaan Hofman <email@hidden>
- Date: Wed, 06 Apr 2011 00:30:08 +0200
On Apr 6, 2011, at 0:21, Justin C. Walker wrote:
> Hi, Christian,
>
> On Apr 5, 2011, at 09:53 , Christiaan Hofman wrote:
>
>> Sometimes I want to test my app with a particular value for a user default. I do this by adding a command line argument (in the info for the executable in Xcode) for the user default key. This works for string values, however when the value needs to be something else (e.g. a boolean), I cannot get this to work. Is there a way to do this?
>
> No. Using the command line (shell), argument passing is always done with strings, so you have to translate in the command. If you want to fuss with fork/exec, you could write a tester that would fuss with the child's address space with (the moral equivalent of) ptrace(), but that's kind of gnarly. Since the kernel does the work in exec(), that's where the semantics of argument-passing is "enforced", so it's just not easy to do (arguments are assumed to be strings, and that is how the kernel deals with them).
>
> At least, that's my best guess.
>
> HTH
>
> Justin
>
> --
> Justin C. Walker, Curmudgeon-At-Large
> Institute for the Enhancement of the Director's Income
> --------
> When LuteFisk is outlawed,
> Only outlaws will have LuteFisk
Well, I would not expect something like this to work, or at least be feasible. I am more thinking of how app executables handle arguments in general. For instance, the 'defaults' CLT allows passing non-string values to be passed (still as strings from the POV of the executable) by adding extra options like -boolean. Isn't there something similar for app executables?
thanks,
Christiaan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden