and up to a minute for the workspace! Is this just me or does anyone else have these problems?
This has been discussed in the past here:
http://forums.codeblocks.org/index.php/topic,16967.90.htmlSomething like this small patch would reduce the abundance MakeRelativeTo calls that are really slow on windows for normal project layouts... e.g. it cuts the C::B project load time to a few seconds.
Index: src/sdk/cbproject.cpp
===================================================================
--- src/sdk/cbproject.cpp (revision 9423)
+++ src/sdk/cbproject.cpp (working copy)
@@ -391,19 +391,23 @@
&& !fileHasUNCName
&& vol.IsSameAs(f->file.GetVolume()) ) )
{
- wxFileName relFileCTLP(f->file);
- relFileCTLP.MakeRelativeTo( m_CommonTopLevelPath );
- wxFileName relFileBase(f->file);
- relFileBase.MakeRelativeTo( GetBasePath() );
+ if (!fileName.StartsWith(m_CommonTopLevelPath))
+ {
+ wxFileName relFileCTLP(f->file);
+ relFileCTLP.MakeRelativeTo( m_CommonTopLevelPath );
+ f->relativeToCommonTopLevelPath = relFileCTLP.GetFullPath();
+ }
+ else
+ f->relativeToCommonTopLevelPath = fileName.Right(fileName.Length() - m_CommonTopLevelPath.Length());
- // The commented (old) method to obtain the relativeToCommonTopLevelPath is fast, but does *not* work, if you save
- // the project on a different drive in a sub-folder of an existing source file on that (different) drive:
- // I.e.: Project on C:\Folder\Project.cbp has file C:\Folder\SubFolder\foo.cpp and D:\Folder\bar.cpp
- // Saved the project under D:\Folder\SubFolder\ProjectNew.cbp would cause a wrong computation of bar.cpp otherwise!!!
-// f->relativeToCommonTopLevelPath = fileName.Right(fileName.Length() - m_CommonTopLevelPath.Length());
- // Using wxFileName instead, although its costly:
- f->relativeToCommonTopLevelPath = relFileCTLP.GetFullPath();
- f->relativeFilename = relFileBase.GetFullPath();
+ if (!fileName.StartsWith(GetBasePath()))
+ {
+ wxFileName relFileBase(f->file);
+ relFileBase.MakeRelativeTo( GetBasePath() );
+ f->relativeFilename = relFileBase.GetFullPath();
+ }
+ else
+ f->relativeFilename = fileName.Right(fileName.Length() - GetBasePath().Length());
}
else
{