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

master
PabloG02 2023-05-31 23:37:18 +07:00 committed by bunnei
parent 33d36ded28
commit 9650c1d02d
1 changed files with 17 additions and 9 deletions

@ -66,7 +66,14 @@ class ImportExportSavesFragment : DialogFragment() {
}
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")
.setPositiveButton("Export") { _, _ ->
exportSave()
@ -76,6 +83,7 @@ class ImportExportSavesFragment : DialogFragment() {
}
.show()
}
}
/**
* Zips the save files located in the given folder path and creates a new zip file with the current date and time.