# Unable to make new directories within Legato app

**URL:** <https://forum.legato.io/t/unable-to-make-new-directories-within-legato-app/2357>\
**Category:** Legato Application Framework\
**Created:** [February 20, 2017, 3:16am UTC](https://forum.legato.io/t/unable-to-make-new-directories-within-legato-app/2357 "2017-02-20T03:16:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raf](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@raf](https://forum.legato.io/u/raf)\
**Post date:** [February 20, 2017, 3:16am UTC](https://forum.legato.io/t/unable-to-make-new-directories-within-legato-app/2357/1 "2017-02-20T03:16:37Z")

</div>

Hi,

My application reads/writes data on an SD card with multiple subdirectories.

This works if I (pre)make the directories manually, I.E. outside of a Legato application from the command line, but not when using `le_dir_MakePath`, `le_dir_Make` or even `mkdir`.

Note that the application is currently running un-sandboxed. The SD card has been mounted at `/mnt/userrw/sd` - the `/sd` dir was also premade, manually.

Ultimately, the system (modem) should be capable of mounting and setting up the directory structure from within a Legato application.

Legato version is 16.10.1

Any help would be greatly appreciated.

Cheers,  
Raf

---

<div class="post-metadata">

**Author:** ![spastor](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/spastor/32/80_2.png) [@spastor](https://forum.legato.io/u/spastor)\
**Post date:** [February 20, 2017, 6:10pm UTC](https://forum.legato.io/t/unable-to-make-new-directories-within-legato-app/2357/2 "2017-02-20T18:10:28Z")

</div>

Hello Raf,

I can help you if you wish because in my product I have an “SD card monitoring service” and applications that read and write data on SD with Legato.

Can you show me your adef file ?

Best regards,  
Sylvain

---

<div class="post-metadata">

**Author:** ![raf](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@raf](https://forum.legato.io/u/raf)\
**Post date:** [February 20, 2017, 11:11pm UTC](https://forum.legato.io/t/unable-to-make-new-directories-within-legato-app/2357/3 "2017-02-20T23:11:29Z")

</div>

Hi Sylvain,

Thanks for the assistance.

I think I’ve sorted it out by adding the following to my `.adef` file:

```auto
requires:
{
    dir:
    {
        // The SD card is mounted at '/mnt/userrw'
        /mnt/userrw /
    }
}

```

Note that this particular app doesn’t do the mounting - only reading and writing. In another app’s .adef I have:

```auto
requires:
{
    device:
    {
        // Request read and write access to the SD card.
        [rw] /dev/mmcblk0p1 /dev/mmcblk0p1
    }
    ...
}

```

Did you have issues running your app(s) sandboxed?  
I get the following error when running the app as sandboxed.  
`LE_FILENAME dir_MakeSmack() 42 | Could not create directory '/mnt/userrw'. Permission denied`

Also, do you mind sharing where you mounted your SD card? Is there perhaps a ‘better’ directory?

Cheers,  
Raf
