# How to configure default path for files accessed using le\_fs

**URL:** <https://forum.legato.io/t/how-to-configure-default-path-for-files-accessed-using-le-fs/2828>\
**Category:** Legato Application Framework\
**Created:** [November 30, 2017, 11:09am UTC](https://forum.legato.io/t/how-to-configure-default-path-for-files-accessed-using-le-fs/2828 "2017-11-30T11:09:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghu.0b](https://avatars.discourse-cdn.com/v4/letter/r/e99b99/32.png) [@raghu.0b](https://forum.legato.io/u/raghu.0b)\
**Post date:** [November 30, 2017, 11:09am UTC](https://forum.legato.io/t/how-to-configure-default-path-for-files-accessed-using-le-fs/2828/1 "2017-11-30T11:09:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pinkesh](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/pinkesh/32/221_2.png) [@pinkesh](https://forum.legato.io/u/pinkesh)\
**Post date:** [February 5, 2018, 2:27pm UTC](https://forum.legato.io/t/how-to-configure-default-path-for-files-accessed-using-le-fs/2828/2 "2018-02-05T14:27:50Z")

</div>

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
