Wp76xx - File storage

Hello,
I am using WP7608 module. In that, trying to write some data.
So, i created directory in /home/root - folder name “TR_VT_ADV” and for writing i am using below mentioned API,
///////////////////////////////////////////////
#define wt_fil “/home/root/TR_VT_ADV/configFile.txt” // path
char name[15] = "Hello World ";

COMPONENT_INIT
{
system("/bin/mkdir /home/root/TR_VT_ADV");

char importStr[15]={0};

sprintf(importStr,"%s",name);

if(fileStore->fWriteFile(wt_fil, importStr, strlen(importStr)) == 1)
			LE_INFO("\n Import hour time saved to file %s",importStr);
		else
			LE_INFO("\n Import hour time save failed");
		delete fileStore;

}
///////////////////////////////////////////
int FileStorageProcess::fWriteFile(const char* fileNamePath, const char* writeString, unsigned int StringByteLength)
{
int ret_tp = -1;

LE_INFO("\n into fWriteFile()");

int fileHandler = 0;
LE_INFO("\n File path");
LE_INFO(fileNamePath);
LE_INFO("\n");
fileHandler = le_atomFile_Create(fileNamePath,LE_FLOCK_READ_AND_WRITE ,LE_FLOCK_OPEN_IF_EXIST,O_RDWR|O_CREAT);

if(LE_DUPLICATE == fileHandler)
{
	LE_INFO("\n file descripter duplicate");

}
else if(LE_FAULT == fileHandler)
{
	LE_INFO("\n file descripter fault");

}
else if(fileHandler > 0)
{
size_t len = StringByteLength;
size_t res = write(fileHandler,writeString,len);
if(res > 0)
{
		LE_INFO(" write data to file %d ", res );
		ret_tp = 1;
}
else
{
		LE_INFO(" write data failed ");
}

if(fileHandler != 0){
	le_result_t result;
	result = le_atomFile_Close(fileHandler);
	if(result == LE_OK)
		{
			LE_INFO("file desc closed file ");
			fileHandler = 0;
		}
	else
		{
			LE_INFO("file descr closing failed");
			fileHandler = 0;
		}
}

}
else
{
	LE_INFO("File descriptor not created");

}

return ret_tp;

}

//////////////////////////////
Debug log:

Feb 4 07:18:10 | lstr29_cam[6440]/framework T=main | LE_FILENAME dir_MakeSmack() 42 | Could not create directory ‘/home/root’. Permission denied
Feb 4 07:18:10 | lstr29_cam[6440]/framework T=main | LE_FILENAME dir_MakePathSmack() 107 | Make directory /home/root failed.
Feb 4 07:18:10 | lstr29_cam[6440]/LSTR29_CAMComponent T=main | LSTR29_CAMComponent.cpp _LSTR29_CAMComponent_COMPONENT_INIT() 50 | mkpath: -6
Feb 4 07:18:10 | lstr29_cam[6440]/LSTR29_CAMComponent T=main | memory.cpp fWriteFile() 113 | into fWriteFile()
Feb 4 07:18:10 | lstr29_cam[6440]/LSTR29_CAMComponent T=main | memory.cpp fWriteFile() 116 | File path
Feb 4 07:18:10 | lstr29_cam[6440]/LSTR29_CAMComponent T=main | memory.cpp fWriteFile() 117 | /home/root/TR-RGT-ADV/configuration.txt
Feb 4 07:18:10 | lstr29_cam[6440]/LSTR29_CAMComponent T=main | memory.cpp fWriteFile() 118 |
Feb 4 07:18:10 | lstr29_cam[6440]/framework T=main | LE_FILENAME Create() 226 | Could not open file ‘.//home/root/TR-RGT-ADV/configuration.txt.lock~~XXXXXX’. No such file or directory.
Feb 4 07:18:10 | lstr29_cam[6440]/LSTR29_CAMComponent T=main | memory.cpp fWriteFile() 128 | file descripter fault

/////////////////////////////
but file not opening . my system not taking this path “/home/root/TR_VT_ADV/configFile.txt” .

If i give without directory,
le_atomFile_Create(configFile.txt,LE_FLOCK_READ_AND_WRITE ,LE_FLOCK_OPEN_IF_EXIST,O_RDWR|O_CREAT);
—> file is create and store in below mentioned path.
root@swi-mdm9x28-wp:/legato/systems/current/appsWriteable/LSTR29_CAM#

Please help me, how to change this directory : “/home/root/TR_VT_ADV/”

Hi Logan,

Please try set below in your app .adef file

sandboxed: false

More info below:
https://docs.legato.io/latest/defFilesAdef.html#defFilesAdef_sandboxed

Hope it helps.
Thx

Thank you so much sir. I can create now.