I want to save my files within a folder but the issue which raising is that my files are storing outside of the folder which is annoying. I am sharing what I have done so far.
-- get raw path to app's Temporary directory
local doc_path = system.pathForFile( "", system.DocumentsDirectory )
-- change current working directory
local success = lfs.chdir( doc_path ) -- returns true on success
local new_folder_path
if success then
lfs.mkdir( "MyNewFolder" )
new_folder_path = lfs.currentdir() .. "/MyNewFolder"
end
local filePath = system.pathForFile( dataFileName , new_folder_path )
r = media.newRecording(filePath)
--print("new recording has been started with a name"..dataFileName)
r:startRecording()
but my recorded file is out of this newly created folder can someone help me here?
I searched out and finally got the answer that the problem.This is how to create a new recording in specified folder
This line would automatically create a file in this folder as mentioned in the question.
system.pathForFile()only creates a file automatically when the second argument is a base directory likesystem.DocumentsDirectory(as it is clearly mentioned in the documentation that the second argument is constant and it should be only any base directory). so if you want to create a new file r want to find the path of the file you would append folder name before the file name likemy folder/my fileHope this would help