lfs File not found

hi all, this is the code:

function setSounds(event)  
 self=event.target  
 if myList~=nil then  
 if myList.isVisible==true then  
 myList.isVisible=false  
 end  
 end  
 local doc\_path = system.pathForFile( nil, system.ResourceDirectory )  
 local target=event.target  
 doc\_path=doc\_path.."/kits/"..dataKits[self.id]  
 local i=1  
 for file in lfs.dir(doc\_path) do  
 if file ~= "." and file ~= ".." then  
 sounds[i]=audio.loadSound(file)  
 i=i+1  
 end  
 end  
end  

and this is the terminal…

WARNING: Cannot create path for resource file '1.mp3'. File does not exist.  
  
WARNING: Failed to create audio sound (1.mp3)  
WARNING: Cannot create path for resource file '10.mp3'. File does not exist.  
  
WARNING: Failed to create audio sound (10.mp3)  
WARNING: Cannot create path for resource file '2.mp3'. File does not exist.  
  
WARNING: Failed to create audio sound (2.mp3)  
WARNING: Cannot create path for resource file '3.mp3'. File does not exist.  
  
WARNING: Failed to create audio sound (3.mp3)  
WARNING: Cannot create path for resource file '4.mp3'. File does not exist.  
  
WARNING: Failed to create audio sound (4.mp3)  
WARNING: Cannot create path for resource file '5.mp3'. File does not exist.  
  
WARNING: Failed to create audio sound (5.mp3)  
WARNING: Cannot create path for resource file '6.mp3'. File does not exist.  
  
WARNING: Failed to create audio sound (6.mp3)  
WARNING: Cannot create path for resource file '7.mp3'. File does not exist.  
  
WARNING: Failed to create audio sound (7.mp3)  
WARNING: Cannot create path for resource file '8.mp3'. File does not exist.  
  
WARNING: Failed to create audio sound (8.mp3)  
WARNING: Cannot create path for resource file '9.mp3'. File does not exist.  
  
WARNING: Failed to create audio sound (9.mp3)  

I can’t understand… [import]uid: 70929 topic_id: 27889 reply_id: 327889[/import]

What happens if you change nil to “” (empty string) in the pathForFile statement?

Update:

I think the problem is you need to add path in the loadSound statement. The default baseDir is ResourceDirectory but it doesn’t know about the subdirectory. Try this:

sounds[i]=audio.loadSound( "/kits/" .. file ) 

Hi Tom, thanks for the answer, with “” in the patForFile, i got an error, but i solved thanks to a friend help.

the solution is the one you write, the relative path:

sounds[i]=audio.loadSound( "/kits/" .. file )

Thanks!
Andrea. [import]uid: 70929 topic_id: 27889 reply_id: 113009[/import]