I’m having problems with finding a json file that I’m saving to system.DocumentsDirectory in CoronaCards.
I can find it from Corona call, of course, but when I try to find it natively in c# - I catch an exception.
Tried to save to system.ResourceDirectory but got same results.
Where should I save/look for my file to make it visible for native environment?
Also, you cannot write to the system.ResourceDirectory on WP8… or iOS and Android. It’s a read-only directory.
However, on WP8, we do give you the option to change the resource directory via RunUsing() to a path that is writeable, but that was intended for developers who download their Corona projects to the device, such as Adobe Flash style apps.
One more thing. I recommend that you use .NET’s System.IO.Path.Combine() method to combine the path with your file name. That way you don’t have to worry about trailing slashes. That said, Corona will always remove the trailing slash from these directories, even if you provide your own custom path with a trailing slash via our RunUsing() method, we still remove the trailing slash.
Joshua, could you write an example how to set Corona Documents folder to ApplicationData.Current.LocalFolder, please? I’m a newbie to C# and I’m not sure how to set it properly…
The above will change Corona’s system.DocumentsDirectory to your WP8 app’s root data folder. By default, we set the documents directory to a “Corona\Documents” subdirectory under the above location.
Now, since your app is set up to be auto-launched because your constructor has the following line…
fCoronaPanel.AutoLaunchEnabled = true
…then Corona will use the “AutoLaunchSettings” by default and you do not have to use our CoronaPanel.Runtime.RunUsing() method.
Also, you cannot write to the system.ResourceDirectory on WP8… or iOS and Android. It’s a read-only directory.
However, on WP8, we do give you the option to change the resource directory via RunUsing() to a path that is writeable, but that was intended for developers who download their Corona projects to the device, such as Adobe Flash style apps.
One more thing. I recommend that you use .NET’s System.IO.Path.Combine() method to combine the path with your file name. That way you don’t have to worry about trailing slashes. That said, Corona will always remove the trailing slash from these directories, even if you provide your own custom path with a trailing slash via our RunUsing() method, we still remove the trailing slash.
Joshua, could you write an example how to set Corona Documents folder to ApplicationData.Current.LocalFolder, please? I’m a newbie to C# and I’m not sure how to set it properly…
The above will change Corona’s system.DocumentsDirectory to your WP8 app’s root data folder. By default, we set the documents directory to a “Corona\Documents” subdirectory under the above location.
Now, since your app is set up to be auto-launched because your constructor has the following line…
fCoronaPanel.AutoLaunchEnabled = true
…then Corona will use the “AutoLaunchSettings” by default and you do not have to use our CoronaPanel.Runtime.RunUsing() method.