Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command-databasse has not pass the true filename to prop_db->write_file(filename, ... #415

Closed
CyanCloverFern opened this issue Sep 7, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@CyanCloverFern
Copy link

CyanCloverFern commented Sep 7, 2024

when i use --command-databasse
i find the error report :
"...writing to command database 'compile_commands.jsonE:\hello\compile_commands.json' FAILED...\n"
i think the problem is the filename string has pass twice. so i modifiy the file "engine\mod_command_db.cpp", i insert a line in function exit_main(int status)

old

void exit_main(int status)
	{
		if (status == EXIT_FAIL) return;
		std::string filename = output_filename;
		if (!b2::paths::is_rooted(output_filename))
		{
			if (!b2::paths::is_rooted(output_directory))
				filename = b2::cwd_str() + "/";
			filename += output_directory + "/" + output_filename;
			filename = b2::paths::normalize(filename);
		}
		if (prop_db->write_file(filename, output_format))
			out_printf("...wrote command database '%s'...\n", filename.c_str());
		else
			err_printf("...writing to command database '%s' FAILED...\n",
				filename.c_str());
	}

new

void exit_main(int status)
	{
		if (status == EXIT_FAIL) return;
		std::string filename = output_filename;
		if (!b2::paths::is_rooted(output_filename))
		{
			filename = {}
			if (!b2::paths::is_rooted(output_directory))
				filename = b2::cwd_str() + "/";
			filename += output_directory + "/" + output_filename;
			filename = b2::paths::normalize(filename);
		}
		if (prop_db->write_file(filename, output_format))
			out_printf("...wrote command database '%s'...\n", filename.c_str());
		else
			err_printf("...writing to command database '%s' FAILED...\n",
				filename.c_str());
	}

then i generate compile_command ok.

os: windows

@CyanCloverFern CyanCloverFern added the bug Something isn't working label Sep 7, 2024
@CyanCloverFern
Copy link
Author

i think my modifiy is not a true change. when i use b2 --command-database=json in b2-main project, it report :
...writing to command database 'E:/b2-5.2.1/.build/compile_commands.json' FAILED...

@grafikrobot grafikrobot self-assigned this Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants