Re: [PATCH BlueZ] tools/meshctl: Fix default directory for JSON files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Luiz,

On Mon, 2018-08-20 at 11:01 +0300, Luiz Augusto von Dentz wrote:
> Hi Inga,
> 
> On Mon, Aug 20, 2018 at 12:30 AM, Inga Stotland <inga.stotland@intel.
> com> wrote:
> > This fixes the name of default directory that contains sample JSON
> > files.
> 
> Just a note regarding modifying/using files on the tree, as we
> experience here it is a bad idea since once we move or it is changed
> this code would have to be changed as well. Also I remember
> commenting
> that if the configuration is changed by meshctl your tree will then
> contain changes that shall not be applied, so instead of changing the
> file in place Id make a default location something like
> ~/.config/meshctl/ and copy over the .json files there if they don't
> exist, that way we avoid having to carry changes in the tree.
> 
> > ---
> >  tools/meshctl.c | 20 ++++++++++----------
> >  1 file changed, 10 insertions(+), 10 deletions(-)
> > 
> > diff --git a/tools/meshctl.c b/tools/meshctl.c
> > index 3e1484f61..a8468b716 100644
> > --- a/tools/meshctl.c
> > +++ b/tools/meshctl.c
> > @@ -1913,21 +1913,20 @@ int main(int argc, char *argv[])
> >         bt_shell_set_prompt(PROMPT_OFF);
> > 
> >         if (!mesh_config_dir) {
> > -               bt_shell_printf("Local config directory not
> > provided.\n");
> > -               mesh_config_dir = "";
> > -       } else {
> > -               bt_shell_printf("Reading prov_db.json and
> > local_node.json from"
> > -                               " %s\n", mesh_config_dir);
> > +               printf("Local config directory not provided.\n");
> > +               mesh_config_dir = "mesh";
> >         }
> > 
> > +       printf("Reading prov_db.json and local_node.json from"
> > +                               " %s directory\n",
> > mesh_config_dir);
> > +
> >         len = strlen(mesh_config_dir);
> > -       if (len && mesh_config_dir[len - 1] != '/') {
> > +
> > +       if (len && mesh_config_dir[len - 1] != '/')
> >                 extra = 1;
> > -               bt_shell_printf("mesh_config_dir[%d] %s\n", len,
> > -                                               &mesh_config_dir[le
> > n - 1]);
> > -       } else {
> > +       else
> >                 extra = 0;
> > -       }
> > +
> >         mesh_local_config_filename = g_malloc(len +
> > strlen("local_node.json")
> >                                                                    
> >      + 2);
> >         if (!mesh_local_config_filename)
> > @@ -1956,6 +1955,7 @@ int main(int argc, char *argv[])
> > 
> >         sprintf(mesh_prov_db_filename, "%s", mesh_config_dir);
> >         len = strlen(mesh_config_dir);
> > +
> >         if (extra)
> >                 sprintf(mesh_prov_db_filename + len , "%c", '/');
> > 
> > --
> > 2.14.4
> > 

Thanks for the feedback. I agree.
Sent patch set v2.

Regards,
Inga




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux