Exemplo n.º 1
0
String _find_build_engine_on_unix(const String &p_name) {
	String ret = path_which(p_name);

	if (ret.length())
		return ret;

	String ret_fallback = path_which(p_name + ".exe");
	if (ret_fallback.length())
		return ret_fallback;

	const char *locations[] = {
#ifdef OSX_ENABLED
		"/Library/Frameworks/Mono.framework/Versions/Current/bin/",
#endif
		"/opt/novell/mono/bin/"
	};

	for (int i = 0; i < sizeof(locations) / sizeof(const char *); i++) {
		String hint_path = locations[i] + p_name;

		if (FileAccess::exists(hint_path)) {
			return hint_path;
		}
	}

	return String();
}
Exemplo n.º 2
0
char *resource_monitor_locate(const char *path_from_cmdline)
{
	char *test_path;
	char *monitor_path;

	debug(D_RMON,"locating resource monitor executable...\n");

	debug(D_RMON,"trying executable from path provided at command line.\n");
	monitor_path = resource_monitor_check_path(path_from_cmdline, NULL);
	if(monitor_path)
		return monitor_path;

	debug(D_RMON,"trying executable from $%s.\n", RESOURCE_MONITOR_ENV_VAR);
	test_path = getenv(RESOURCE_MONITOR_ENV_VAR);
	monitor_path = resource_monitor_check_path(test_path, NULL);
	if(monitor_path)
		return monitor_path;

	debug(D_RMON,"trying executable at local directory.\n");
	//LD_CONFIG version.
	monitor_path = resource_monitor_check_path("./", "resource_monitor");
	if(monitor_path)
		return monitor_path;

	debug(D_RMON,"trying executable at PATH.\n");
	//LD_CONFIG version.
	monitor_path = path_which("resource_monitor");
	if(monitor_path)
		return monitor_path;

	//static "vanilla" version
	monitor_path = path_which("resource_monitorv");
	if(monitor_path)
		return monitor_path;

	debug(D_RMON,"trying executable at installed path location.\n");
	//LD_CONFIG version.
	monitor_path = resource_monitor_check_path(INSTALL_PATH, "bin/resource_monitor");
	if(monitor_path)
		return monitor_path;

	//static "vanilla" version
	monitor_path = resource_monitor_check_path(INSTALL_PATH, "bin/resource_monitorv");
	if(monitor_path)
		return monitor_path;

	return NULL;
}
Exemplo n.º 3
0
Error GodotSharpEditor::open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) {

	ExternalEditor editor = ExternalEditor(int(EditorSettings::get_singleton()->get("mono/editor/external_editor")));

	switch (editor) {
		case EDITOR_CODE: {
			List<String> args;
			args.push_back(ProjectSettings::get_singleton()->get_resource_path());

			String script_path = ProjectSettings::get_singleton()->globalize_path(p_script->get_path());

			if (p_line >= 0) {
				args.push_back("-g");
				args.push_back(script_path + ":" + itos(p_line) + ":" + itos(p_col));
			} else {
				args.push_back(script_path);
			}

			static String program = path_which("code");

			Error err = OS::get_singleton()->execute(program.length() ? program : "code", args, false);

			if (err != OK) {
				ERR_PRINT("GodotSharp: Could not execute external editor");
				return err;
			}
		} break;
		case EDITOR_MONODEVELOP: {
			if (!monodevel_instance)
				monodevel_instance = memnew(MonoDevelopInstance(GodotSharpDirs::get_project_sln_path()));

			String script_path = ProjectSettings::get_singleton()->globalize_path(p_script->get_path());
			monodevel_instance->execute(script_path);
		} break;
		default:
			return ERR_UNAVAILABLE;
	}

	return OK;
}