File saving

For my mobile builds, I have it set up so at the end of every level a screen shot is taken of the game board and the user is given the option of sharing this on Facebook.

From what I have read, there isn’t any help from corona yet for Facebook on desktop builds. However, I would like it if users could save their screen shots to a directory of their choice (just like saving a file in any other app).

Is there a way to present the save dialog to the user in such a way? I haven’t seen anything about it in the documentation; but perhaps someone has done something similar?

As an aside, is there documentation for the desktop builds anywhere (detailing which corona helper functions are available for desktop builds already)? Or is it just stabbing around in the dark a bit? May be a bit of a newbie question, but I haven’t seen any.

Regards,

L

Regarding your first question, Glitch Games posed a similar one in the forums recently. It should give you some information on how to obtain the correct path when saving your screenshots within a desktop app:

https://forums.coronalabs.com/topic/58982-accessing-documents-directory-in-mac-app-store-published-app

Regarding your second question, the link below is to the Win32 and OSX docs, respectively. In each, they note which features are and are not available:

https://docs.coronalabs.com/daily/guide/distribution/win32Build/index.html

https://docs.coronalabs.com/daily/guide/distribution/osxBuild/index.html

Thanks

Regarding facebook, there is no Facebook SDK for Windows or OS X.  That’s not a Corona limitation.  Facebook doesn’t have a library for desktop users to use.  So, you have to use Facebook’s web/graph APIs via Corona’s network.request() APIs instead.

We currently do not provide a “Save As” dialog option for desktop that let’s the end-user choose where to save files.  This is because we’ve never needed one before since sandboxing rules on iOS didn’t allow for it.  That said, if you use Corona’s display.catpure*() APIs, then there is a Boolean argument that allows you to save the image to the user’s “My Pictures” directory equivalent on Windows.  On OS X, it saves to users desktop instead.  This might be a good option for you at the moment… and it is an appropriate location for pictures.

   display.capture(display.stage, { saveToPhotoLibrary = true, isFullResolution = true })

Another solution, but admittedly not a great one, is that you can save the image file to your project’s “DocumentsDirectory”.  You can then use our system.openURL() API and feed it a path to your documents directory, which will display that directory via Windows Explorer or Finder to the end-user to allow them to choose what to do with the file.  The only thing I don’t like about this is that your Documents directory is under a hidden directory for both Windows and OS X, which was intended to be used for your own app’s purposes… such as for storing your config files or SQLite database.  Anyways, you can display your Documents directory to the user by doing the following…

   system.openURL(system.pathForFile("", system.DocumentsDirectory)

Regarding your first question, Glitch Games posed a similar one in the forums recently. It should give you some information on how to obtain the correct path when saving your screenshots within a desktop app:

https://forums.coronalabs.com/topic/58982-accessing-documents-directory-in-mac-app-store-published-app

Regarding your second question, the link below is to the Win32 and OSX docs, respectively. In each, they note which features are and are not available:

https://docs.coronalabs.com/daily/guide/distribution/win32Build/index.html

https://docs.coronalabs.com/daily/guide/distribution/osxBuild/index.html

Thanks

Regarding facebook, there is no Facebook SDK for Windows or OS X.  That’s not a Corona limitation.  Facebook doesn’t have a library for desktop users to use.  So, you have to use Facebook’s web/graph APIs via Corona’s network.request() APIs instead.

We currently do not provide a “Save As” dialog option for desktop that let’s the end-user choose where to save files.  This is because we’ve never needed one before since sandboxing rules on iOS didn’t allow for it.  That said, if you use Corona’s display.catpure*() APIs, then there is a Boolean argument that allows you to save the image to the user’s “My Pictures” directory equivalent on Windows.  On OS X, it saves to users desktop instead.  This might be a good option for you at the moment… and it is an appropriate location for pictures.

   display.capture(display.stage, { saveToPhotoLibrary = true, isFullResolution = true })

Another solution, but admittedly not a great one, is that you can save the image file to your project’s “DocumentsDirectory”.  You can then use our system.openURL() API and feed it a path to your documents directory, which will display that directory via Windows Explorer or Finder to the end-user to allow them to choose what to do with the file.  The only thing I don’t like about this is that your Documents directory is under a hidden directory for both Windows and OS X, which was intended to be used for your own app’s purposes… such as for storing your config files or SQLite database.  Anyways, you can display your Documents directory to the user by doing the following…

   system.openURL(system.pathForFile("", system.DocumentsDirectory)