User forums > Help
Issue about saving the cbp project file
ollydbg:
Ok, it works OK now, with this patch:
--- Code: ---Index: E:/code/cb/cb_trunk/src/sdk/projectloader.cpp
===================================================================
--- E:/code/cb/cb_trunk/src/sdk/projectloader.cpp (revision 7781)
+++ E:/code/cb/cb_trunk/src/sdk/projectloader.cpp (working copy)
@@ -1169,7 +1169,31 @@
fname.ClearExt();
outputFileName = fname.GetFullPath();
}
+ if ( (prefixPolicy == tgfpPlatformDefault)
+ && ( (!platform::windows && target->GetTargetType() == ttDynamicLib)
+ || (target->GetTargetType() == ttStaticLib) ) )
+ {
+ wxString compilerId = target->GetCompilerID();
+ Compiler* compiler = CompilerFactory::GetCompiler(compilerId);
+ if (compiler)
+ {
+ wxFileName fname(outputFileName);
+ wxString outputFileNameFile(fname.GetFullName());
+ wxString compilerLibPrefix(compiler->GetSwitches().libPrefix);
+ wxString outputFileNameWOPrefix;
+ if (outputFileNameFile.StartsWith(compilerLibPrefix))
+ {
+ outputFileNameWOPrefix = outputFileNameFile.Mid(compilerLibPrefix.Len());
+ if (!outputFileNameWOPrefix.IsEmpty())
+ {
+ fname.SetFullName(outputFileNameWOPrefix);
+ outputFileName = fname.GetFullPath();
+ }
+ }
+ }
+ }
+
TiXmlElement* outnode = AddElement(tgtnode, "Option", "output", outputFileName);
outnode->SetAttribute("prefix_auto", prefixPolicy == tgfpPlatformDefault ? "1" : "0");
outnode->SetAttribute("extension_auto", extensionPolicy == tgfpPlatformDefault ? "1" : "0");
--- End code ---
MortenMacFly:
--- Quote from: ollydbg on February 06, 2012, 01:31:39 pm ---Ok, it works OK now, with this patch:
--- End quote ---
Good to know. Feel free t commit making oBFusCATed happy... hopefully... ;-)
ollydbg:
--- Quote from: MortenMacFly on February 06, 2012, 01:59:12 pm ---
--- Quote from: ollydbg on February 06, 2012, 01:31:39 pm ---Ok, it works OK now, with this patch:
--- End quote ---
Good to know. Feel free t commit making oBFusCATed happy... hopefully... ;-)
--- End quote ---
OK, done At revision: 7782.
ollydbg:
Hi, Morten, I need to bump this thread again, as I nowadays still find annoying issue about this:
--- Quote from: ollydbg on February 06, 2012, 01:50:51 am ---Steps to reproduce: (WinXP)
1, open a clean Codeblocks.cbp in a recent debugger branch nightly build.
2, change the command argument for src, like adding "-p=debugCC".
3, close this project.
Now, I can see that:
1, The EOL changing from CRLF to LF
--- End quote ---
See, the cbp file was saved from CRLF to LF always. This always give me a warning if I commit to the git local repo. (git would say that: warning: LF will be replaced by CRLF in such cbp files in the repo.....)
I trace down and found that in the last stage of saving cbp file, we have such code:
--- Code: ---bool TinyXML::SaveDocument(const wxString& filename, TiXmlDocument* doc)
{
if (!doc)
return false;
TiXmlPrinter printer;
printer.SetIndent("\t");
doc->Accept(&printer);
return Manager::Get()->GetFileManager()->SaveUTF8(filename, printer.CStr(), printer.Size());
}
--- End code ---
Here, we create a printer object, which has:
--- Code: ---class TiXmlPrinter : public TiXmlVisitor
{
public:
TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ),
buffer(), indent( " " ), lineBreak( "\n" ) {}
--- End code ---
Look, it always use lineBreak( "\n" ).
Can we fix it by setting the lineBreak by platform?
Thanks.
thomas:
Look, if GIT is too stupid to handle files it shouldn't touch at all, then that's sad. In particular because GIT is a Linux revision control system, and these are Unix line endings. But frankly, it's GIT's problem, not ours. GIT has no reason to look into .cbp files at all, for all it knows, these are binary files, just like .conf files.
Please don't tamper with code that works fine only to make it worse just so some unimportant third party program doesn't complain. If users of this third party program are unhappy with its operation, they can either fix their settings so it properly ignores the files, or they can complain with the maintainer of that program.
There was a similar issue with people editing .conf files in a text editor and complaining that they were broken afterwards. Because, hey, if something looks like you could edit it, then it is totally necessary that you do. I was at some point tempted to rot13 encode config files only for that reason.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version