ANDROID: Create and Register default path for icons

This commit is contained in:
Antoniou Athanasios 2023-02-26 19:59:56 +02:00 committed by antoniou79
parent d6c0aeafcb
commit afb267c83d
3 changed files with 30 additions and 0 deletions

View file

@ -456,6 +456,11 @@ void OSystem_Android::initBackend() {
// TODO remove the debug message eventually
LOGD("Setting DefaultSaveFileManager path to: %s", ConfMan.get("savepath").c_str());
ConfMan.registerDefault("iconspath", ConfMan.get("path") + "/icons");
// TODO remove the debug message eventually
LOGD("Setting Default Icons and Shaders path to: %s", ConfMan.get("iconspath").c_str());
_timerManager = new DefaultTimerManager();
_event_queue_lock = new Common::Mutex();

View file

@ -1845,6 +1845,29 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
}
}
}
// Also create the default directory for icons and shaders
File defaultScummVMIconsPath = new File(_actualScummVMDataDir, "icons");
if (defaultScummVMIconsPath.exists() && defaultScummVMIconsPath.isDirectory()) {
Log.d(ScummVM.LOG_TAG, "ScummVM default icons/shaders path already exists: " + defaultScummVMIconsPath.getPath());
} else if (!defaultScummVMIconsPath.exists() && defaultScummVMIconsPath.mkdirs()) {
Log.d(ScummVM.LOG_TAG, "Created ScummVM default icons/shaders path: " + defaultScummVMIconsPath.getPath());
} else {
Log.e(ScummVM.LOG_TAG, "Could not create folder for ScummVM default icons/shaders path: " + defaultScummVMIconsPath.getPath());
new AlertDialog.Builder(this)
.setTitle(R.string.no_icons_path_title)
.setIcon(android.R.drawable.ic_dialog_alert)
.setMessage(R.string.no_icons_path_configured)
.setNegativeButton(R.string.quit,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
.show();
return false;
}
return true;
}

View file

@ -25,6 +25,8 @@
<string name="no_config_file">Unable to read ScummVM config file or create a new one!</string>
<string name="no_save_path_title">Save Path Error</string>
<string name="no_save_path_configured">Unable to create or access default save path!</string>
<string name="no_icons_path_title">Icons Path Error</string>
<string name="no_icons_path_configured">Unable to create or access default icons and shaders path!</string>
<string name="bad_explicit_save_path_configured">Unable to access the globally set save path! Please revert to default from ScummVM Options</string>
<!-- <string name="no_plugins_title">No plugins found</string> -->
<!-- <string name="no_plugins_found">ScummVM requires at least one <i>game