Check if folder exists before letting the user import/export saves

This commit is contained in:
PabloG02 2023-05-31 23:37:18 +02:00 committed by bunnei
parent 33d36ded28
commit 9650c1d02d

View file

@ -66,7 +66,14 @@ class ImportExportSavesFragment : DialogFragment() {
} }
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return MaterialAlertDialogBuilder(requireContext()) return if (savesFolderRoot == "") {
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.import_export_saves)
.setMessage("No profileID found. Launch a game first and then come back.")
.setPositiveButton(android.R.string.ok, null)
.show()
} else {
MaterialAlertDialogBuilder(requireContext())
.setTitle("Import/Export Saves") .setTitle("Import/Export Saves")
.setPositiveButton("Export") { _, _ -> .setPositiveButton("Export") { _, _ ->
exportSave() exportSave()
@ -76,6 +83,7 @@ class ImportExportSavesFragment : DialogFragment() {
} }
.show() .show()
} }
}
/** /**
* Zips the save files located in the given folder path and creates a new zip file with the current date and time. * Zips the save files located in the given folder path and creates a new zip file with the current date and time.