testing 8.2 using qemu
Gary C Martin
gary at garycmartin.com
Thu Sep 18 22:24:35 EDT 2008
Hi Gabriel,
On 19 Sep 2008, at 01:43, Gabriel Eirea wrote:
> I appreciate your explanation but my question was not about the
> literal meaning but about where in the filesystem does the variable
> point to.
I just looked at where my Moon activity was being told to write:
/home/olpc/isolation/1/uid_to_home_dir/10000/data/
> My thinking was: I need to read a configuration file that I
> myself generate and ship in the bundle, but then rainbow doesn't let
> me read it because it's in $HOME, so where should I put that file and
> how do I put it there? Now the question seems pointless because if
> understood correctly $SUGAR_ACTIVITY_ROOT is mostly used for writing
> files. Then, I'm guessing the case scenario is this: if you have
> read-only files then it is ok to leave them in $HOME; if you have
> read-write files then you should write them to
> $SUGAR_ACTIVITY_ROOT/data. My question now is: if you have a
> configuration file with some preset values that goes in the bundle and
> the user changes it, the application should be able to read it from
> $HOME the first time, copy the original file from $HOME to
> $SUGAR_ACTIVITY_ROOT/data and then use that copy in the future ?
Not sure if this will help, but Moon-5 implements a couple of things
that seem similar to what you might be after. I still need to do a
cleanup of various source odds and ends, but have a look at the
moon.py blob at:
http://dev.laptop.org/git?p=activities/moon;a=tree
The "read_and_parse_preferences" method should be helpful, as should
"write_file", basically it's storing and retrieving a couple of
values*** into $SUGAR_ACTIVITY_ROOT/data/defaults so that the view
settings will now stick. The settings are also going into the Journal
entry, with Journal data taking precedents over default data (so
resumes pickup where they left off and clean activity launches inherit
the last used defaults).
*** I was recommended to use json as a general way of storing
preference like data as it's a clean text format that can potentially
be parsed easily by other code if needed.
--Gary
More information about the Devel
mailing list