2
2
* This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3
3
* http://www.gnu.org/licenses/gpl-3.0.html
6
* $Id: msvcworkspaceloader.cpp 4909 2008-02-27 13:15:26Z mortenmacfly $
7
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/projectsimporter/msvcworkspaceloader.cpp $
6
* $Id: msvcworkspaceloader.cpp 5582 2009-05-03 13:45:08Z biplab $
7
* $HeadURL: svn+ssh://jenslody@svn.berlios.de/svnroot/repos/codeblocks/trunk/src/plugins/projectsimporter/msvcworkspaceloader.cpp $
86
86
wxString line = input.ReadLine();
87
87
if (line.IsEmpty())
89
Manager::Get()->GetLogManager()->DebugLog(_T("Unsupported format."));
89
Manager::Get()->GetLogManager()->DebugLog(_T("Workspace file has unsupported format."));
92
92
comps = GetArrayFromString(line, _T(","));
96
96
if (line != _T("Microsoft Developer Studio Workspace File"))
98
Manager::Get()->GetLogManager()->DebugLog(_T("Unsupported format."));
98
Manager::Get()->GetLogManager()->DebugLog(_T("Workspace file has unsupported format."));
101
101
line = comps.GetCount() > 1 ? comps[1] : wxString(wxEmptyString);
103
103
line.Trim(false);
104
105
if (line != _T("Format Version 6.00"))
105
Manager::Get()->GetLogManager()->DebugLog(_T("Format not recognized. Will try to parse though..."));
106
Manager::Get()->GetLogManager()->DebugLog(_T("Workspace format not recognized. Will try to parse though..."));
108
109
ImportersGlobals::UseDefaultCompiler = !askForCompiler;
137
139
int minus = line.Find(_T('-'), true); // search from end
139
141
if (equal == -1 || minus == -1)
143
Manager::Get()->GetLogManager()->DebugLog(_T("Skipping invalid project (unrecognised format) in workspace file."));
142
147
// read project title and trim quotes
143
148
wxString prjTitle = line.Left(equal);
144
149
prjTitle.Trim(true);
145
150
prjTitle.Trim(false);
146
151
if (prjTitle.IsEmpty())
153
Manager::Get()->GetLogManager()->DebugLog(_T("Skipping invalid project (empty name) in workspace file."));
148
156
if (prjTitle.GetChar(0) == _T('\"'))
150
158
prjTitle.Truncate(prjTitle.Length() - 1);
156
164
wxString prjFile = line.Mid(equal, minus - equal);
157
165
prjFile.Trim(true);
158
166
prjFile.Trim(false);
159
168
if (prjFile.IsEmpty())
170
Manager::Get()->GetLogManager()->DebugLog(_T("Skipping invalid project (empty file) in workspace file."));
161
174
if (prjFile.GetChar(0) == _T('\"'))
163
176
prjFile.Truncate(prjFile.Length() - 1);
164
177
prjFile.Remove(0, 1);
168
180
wxFileName fname(UnixFilename(prjFile));
169
181
fname.Normalize(wxPATH_NORM_ALL, wfname.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR), wxPATH_NATIVE);
182
if (!fname.FileExists())
184
#if wxCHECK_VERSION(2, 9, 0)
185
Manager::Get()->GetLogManager()->DebugLog(F(_T("Project '%s' from '%s' not found."), prjTitle.wx_str(), fname.GetFullPath().wx_str()));
187
Manager::Get()->GetLogManager()->DebugLog(F(_T("Project '%s' from '%s' not found."), prjTitle.c_str(), fname.GetFullPath().c_str()));
191
#if wxCHECK_VERSION(2, 9, 0)
192
Manager::Get()->GetLogManager()->DebugLog(F(_T("Found project '%s' in '%s'"), prjTitle.wx_str(), fname.GetFullPath().wx_str()));
170
194
Manager::Get()->GetLogManager()->DebugLog(F(_T("Found project '%s' in '%s'"), prjTitle.c_str(), fname.GetFullPath().c_str()));
172
197
int percentage = ((int)file.TellI())*100 / (int)(file.GetLength());
198
// While updating the progrerss dialog check for cancellation - probably interrupt.
173
199
if (!progress.Update(percentage, _("Importing project: ") + prjTitle))
176
202
project = Manager::Get()->GetProjectManager()->LoadProject(fname.GetFullPath(), false);
177
if (!firstproject) firstproject = project;
178
if (project) registerProject(project->GetTitle(), project);
204
firstproject = project;
207
#if wxCHECK_VERSION(2, 9, 0)
208
Manager::Get()->GetLogManager()->Log(F(_("Warning: Unable to load project '%s' from '%s'"), prjTitle.wx_str(), fname.GetFullPath().wx_str()));
210
Manager::Get()->GetLogManager()->Log(F(_("Warning: Unable to load project '%s' from '%s'"), prjTitle.c_str(), fname.GetFullPath().c_str()));
214
#if wxCHECK_VERSION(2, 9, 0)
215
Manager::Get()->GetLogManager()->Log(F(_("Registering project '%s' from '%s'"), prjTitle.wx_str(), fname.GetFullPath().wx_str()));
217
Manager::Get()->GetLogManager()->Log(F(_("Registering project '%s' from '%s'"), prjTitle.c_str(), fname.GetFullPath().c_str()));
219
registerProject(project->GetTitle(), project);
181
224
* example wanted line: