How to configure default path for files accessed using le_fs

I wanted to know how to change the default path for the files created using le_fs interfaces.

in fs.c i found the macro
//--------------------------------------------------------------------------------------------------
/**

  • Default prefix path for RW if nothing is defined in the config tree
    */
    //--------------------------------------------------------------------------------------------------
    #define FS_PREFIX_DATA_PATH “/data/le_fs/”

This path is not considered while using le_dir interfaces. I am using a legacy application where we first create the directory structure and then create all the files. When this is ported to legato using le_dir and le_fs interfaces, two difference directory structures are getting created.

Can you let me know how to override the FS_PREFIX_DATA_PATH? We are not using any config tree.

Appreciate any help regarding this.

I am using legato af 17.06.0 on wp8548 and mangOH green board.

Answer: le_fs API will be create the files with below prefix:
#define FS_PREFIX_DATA_PATH “/data/le_fs/”
or
“/tmp/data/le_fs/”
When user calls le_fs_Open() API, it will first see the accessibility of “/data/le_fs” path. If this path is not present, then it will try to create the directory “/data/le_fs/”. If the directory will be not able to create then it will create “/tmp/data/le_fs” directory.

So the only possibility to configure the path for le_fs is to change the value of the macro: FS_PREFIX_DATA_PATH in fs.c file.

le_dir and le_fs APIs are defined in two different files and#define FS_PREFIX_DATA_PATH “/data/le_fs/” macro is defined locally in fs.c file. and it is no more useful in le_dir APIs.

For you use case, you can update FS_PREFIX_DATA_PATH macro with your directory path and use only le_fs APIs. le_dir APIs are not required for your use case.

Thanks