Getting a path to SUGAR_ACTVITY_ROOT
pgf at laptop.org
pgf at laptop.org
Thu Sep 11 18:04:48 EDT 2008
john -- scott's not in the office right now, so i'll take a stab
at this. your code snippet looks fine, except for the typo in
"SUGAR_ACTVITY_ROOT". i hope that's all it is.
paul
john wrote:
> Hi, Scott.
>
> I wonder if you could give me a bit of guidance. The Scratch file
> dialogs have shortcuts for common folders on Windows and Mac, such as
> the desktop and the user's documents folder. Most of these shortcuts
> make no sense on the XO, but I thought that perhaps the documents
> shortcut could go to $SUGAR_ACTVITY_ROOT/data. But my first attempt to
> lookup that environment variable did not seem to work (although I have
> not tried it in the context of your new wrapper; maybe it does work
> now).
>
> Anyhow, the code I wrote to do this is:
>
> char *s = NULL;
>
> path[0] = 0; // a zero-length path indicates failure
>
> s = getenv("SUGAR_ACTVITY_ROOT");
> if (s != NULL) {
> strncat(path, s, maxPath);
> strncat(path, "/data", maxPath);
> }
>
> where path is a C string passed in by the client that is supposed to
> get filled in with the path to documents folder.
>
> I'm not used to programming in Unix. Does this look okay to you?
>
> -- John
>
> _______________________________________________
> Devel mailing list
> Devel at lists.laptop.org
> http://lists.laptop.org/listinfo/devel
=---------------------
paul fox, pgf at laptop.org
More information about the Devel
mailing list