Add OS::open_with_program for opening files/directories with a specific program on macOS

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
This commit is contained in:
Mikael Hermansson
2025-06-05 09:12:51 +02:00
parent 1b37dacc18
commit f610c81943
7 changed files with 83 additions and 3 deletions

View File

@ -437,6 +437,14 @@ int OS::create_instance(const Vector<String> &p_arguments) {
return pid;
}
Error OS::open_with_program(const String &p_program_path, const Vector<String> &p_paths) {
List<String> paths;
for (const String &path : p_paths) {
paths.push_back(path);
}
return ::OS::get_singleton()->open_with_program(p_program_path, paths);
}
int OS::create_process(const String &p_path, const Vector<String> &p_arguments, bool p_open_console) {
List<String> args;
for (const String &arg : p_arguments) {
@ -755,6 +763,7 @@ void OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("execute_with_pipe", "path", "arguments", "blocking"), &OS::execute_with_pipe, DEFVAL(true));
ClassDB::bind_method(D_METHOD("create_process", "path", "arguments", "open_console"), &OS::create_process, DEFVAL(false));
ClassDB::bind_method(D_METHOD("create_instance", "arguments"), &OS::create_instance);
ClassDB::bind_method(D_METHOD("open_with_program", "program_path", "paths"), &OS::open_with_program);
ClassDB::bind_method(D_METHOD("kill", "pid"), &OS::kill);
ClassDB::bind_method(D_METHOD("shell_open", "uri"), &OS::shell_open);
ClassDB::bind_method(D_METHOD("shell_show_in_file_manager", "file_or_dir_path", "open_folder"), &OS::shell_show_in_file_manager, DEFVAL(true));