|
From: Douglas L. P. <dou...@gm...> - 2009-08-13 14:26:11
|
Hi guys,
Thanks for reading my e-mail.
I'm a developer and I'm using python to automate a few steps in the
creation of configuration files for msynctool.
I'm facing a few problems and would like to ask your help.
First of all, I'm using opensync 0.22 on ubuntu linux 2.6.30.
My first though was to use os.system and call msynctool passing the
correct parameters, like this:
os.system('msynctool --addgroup ' + group)
os.system('msynctool --addmember ' + group + ' file-sync')
os.system('msynctool --configure ' + group + ' 1')
The problem with this approach is that when the configure option is
called msynctool will pop up a editor window which python has no
control over.
I modified msynctool to not open the editor but still create the config files.
Now I have another problem. How do I know the name of the group
created by msynctool?
I modified msynctool again to create a group folder with the name of
the group but I wasn't able to get the environment directory
(default=~/.opensync-0.22) since the method to retrieve it is private.
It means that I can create a fancy group folder but I don't know where
:(
Here is the little modification I made to addGroup function on msynctool:
void addgroup(OSyncEnv *osync, char *groupname)
{
OSyncGroup *group = osync_group_new(osync);
osync_group_set_name(group, groupname);
osync_group_set_configdir(group, g_strdup_printf("group_%s",
groupname));
OSyncError *error = NULL;
if (!osync_group_save(group, &error)) {
printf("Unable to save group: %s\n", osync_error_print(&error));
osync_error_free(&error);
}
}
As you already figured it out, using that function will result in a
folder created in the same directory msynctool is called.
Does anyone know how can I create my group folders inside the
environment directory? Have in mind that I'm avoiding any changes in
opensync.
Thanks for your time.
Douglas
|