User forums > Help

Issue about saving the cbp project file

<< < (2/5) > >>

MortenMacFly:

--- Quote from: MortenMacFly on February 06, 2012, 10:50:13 am ---...a better quick hack:

--- End quote ---
Hey, this one should actually already work - can someone try? (I don't have access to Code::Blocks to try myself at the moment).

Edit: Aaaah - nope, something is missing. If I read it correctly, then outputFileName at that point included the full path... that won't work. However, you surely get the idea...

MortenMacFly:
...OK - another trial. Who will try this:

--- Code: ---            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();
                        }
                    }
                }
            }

--- End code ---
?
;D

ollydbg:

--- Quote from: MortenMacFly on February 06, 2012, 11:11:19 am ---...OK - another trial. Who will try this:

--- Code: ---            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();
                        }
                    }
                }
            }

--- End code ---
?
;D

--- End quote ---

I test it and the result looks like:

--- Code: --- <Build>
  <Target title="exchndl">
  <Option platforms="Windows;" />
- <Option output="devel\exchndl" prefix_auto="1" extension_auto="1" />
+ <Option output="devel\exchndl.dll" prefix_auto="1" extension_auto="1" />
  <Option working_dir="devel" />
  <Option type="3" />
  <Option compiler="gcc" />
@@ -24,7 +24,7 @@
  </Linker>
  </Target>
  <Target title="tinyXML">
- <Option output="base\tinyxml\txml" prefix_auto="1" extension_auto="1" />
+ <Option output="base\tinyxml\txml.a" prefix_auto="1" extension_auto="1" />
  <Option working_dir="" />
  <Option type="2" />
  <Option compiler="gcc" />

--- End code ---

MortenMacFly:

--- Quote from: ollydbg on February 06, 2012, 01:03:08 pm ---I test it and the result looks like:

--- Code: ---- <Option output="devel\exchndl" prefix_auto="1" extension_auto="1" />
+ <Option output="devel\exchndl.dll" prefix_auto="1" extension_auto="1" />

--- End code ---

--- End quote ---
Hmmm... that is weird. Did you remove the extension policy? The code snippet was intended to be added and not to replace something.

ollydbg:

--- Quote from: MortenMacFly on February 06, 2012, 01:05:55 pm ---
--- Quote from: ollydbg on February 06, 2012, 01:03:08 pm ---I test it and the result looks like:

--- Code: ---- <Option output="devel\exchndl" prefix_auto="1" extension_auto="1" />
+ <Option output="devel\exchndl.dll" prefix_auto="1" extension_auto="1" />

--- End code ---

--- End quote ---
Hmmm... that is weird. Did you remove the extension policy? The code snippet was intended to be added and not to replace something.

--- End quote ---
Oh, I removed the original code snippets in the if statement. I'm adding them and test again.
Do you mean like below:

--- 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)
@@ -1163,8 +1163,29 @@
             target->GetTargetFilenameGenerationPolicy(prefixPolicy, extensionPolicy);
 
             wxString outputFileName = target->GetOutputFilename();
-            if (extensionPolicy == tgfpPlatformDefault)
+            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();
+                        }
+                    }
+                }
                 wxFileName fname(outputFileName);
                 fname.ClearExt();
                 outputFileName = fname.GetFullPath();


--- End code ---

I tested but it still give the same diff files.

EDIT
Oh, I made a mistake:

--- Code: ----            if (extensionPolicy == tgfpPlatformDefault)
+            if (   (prefixPolicy == tgfpPlatformDefault)

--- End code ---

I should preserve a old policy (if statement).

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version