0

ファイルがコロナ SDK の system.DocumentsDirectory に存在するかどうかを確認できますか?

どうやってやるの?

if ( myGameSettings exists ) then 

else

end

前もって感謝します!

4

1 に答える 1

3

ファイルが存在するかどうかを確認するには、次のようにします。

--> Specify the path
local path = system.pathForFile( "myGameSettings.txt", system.DocumentsDirectory )

--> This opens the specified file and returns nil if it couldn't be found
local fh = io.open( path, "r" )


if fh then

   --> File Found

else

   --> File not found

end
于 2013-05-13T21:14:31.483 に答える