~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/projectsimporter/msvcworkspaceloader.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
4
4
 *
5
 
 * $Revision: 4909 $
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 $
 
5
 * $Revision: 5582 $
 
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 $
8
8
 */
9
9
 
10
10
#include "sdk.h"
86
86
        wxString line = input.ReadLine();
87
87
        if (line.IsEmpty())
88
88
        {
89
 
            Manager::Get()->GetLogManager()->DebugLog(_T("Unsupported format."));
 
89
            Manager::Get()->GetLogManager()->DebugLog(_T("Workspace file has unsupported format."));
90
90
            return false;
91
91
        }
92
92
        comps = GetArrayFromString(line, _T(","));
95
95
        line.Trim(false);
96
96
        if (line != _T("Microsoft Developer Studio Workspace File"))
97
97
        {
98
 
            Manager::Get()->GetLogManager()->DebugLog(_T("Unsupported format."));
 
98
            Manager::Get()->GetLogManager()->DebugLog(_T("Workspace file has unsupported format."));
99
99
            return false;
100
100
        }
101
101
        line = comps.GetCount() > 1 ? comps[1] : wxString(wxEmptyString);
102
102
        line.Trim(true);
103
103
        line.Trim(false);
 
104
 
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..."));
106
107
    }
107
108
 
108
109
    ImportersGlobals::UseDefaultCompiler = !askForCompiler;
118
119
    wxFileName wfname = filename;
119
120
    wfname.Normalize();
120
121
    Manager::Get()->GetLogManager()->DebugLog(_T("Workspace dir: ") + wfname.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR));
 
122
 
121
123
    while (!file.Eof())
122
124
    {
123
125
        wxString line = input.ReadLine();
137
139
            int minus = line.Find(_T('-'), true); // search from end
138
140
 
139
141
            if (equal == -1 || minus == -1)
 
142
            {
 
143
                Manager::Get()->GetLogManager()->DebugLog(_T("Skipping invalid project (unrecognised format) in workspace file."));
140
144
                continue;
 
145
            }
141
146
 
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())
 
152
            {
 
153
                Manager::Get()->GetLogManager()->DebugLog(_T("Skipping invalid project (empty name) in workspace file."));
147
154
                continue;
 
155
            }
148
156
            if (prjTitle.GetChar(0) == _T('\"'))
149
157
            {
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);
 
167
 
159
168
            if (prjFile.IsEmpty())
 
169
            {
 
170
                Manager::Get()->GetLogManager()->DebugLog(_T("Skipping invalid project (empty file) in workspace file."));
160
171
                continue;
 
172
            }
 
173
 
161
174
            if (prjFile.GetChar(0) == _T('\"'))
162
175
            {
163
176
                prjFile.Truncate(prjFile.Length() - 1);
164
177
                prjFile.Remove(0, 1);
165
178
            }
166
179
 
167
 
            ++count;
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())
 
183
            {
 
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()));
 
186
                #else
 
187
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Project '%s' from '%s' not found."), prjTitle.c_str(), fname.GetFullPath().c_str()));
 
188
                #endif
 
189
                continue;
 
190
            }
 
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()));
 
193
            #else
170
194
            Manager::Get()->GetLogManager()->DebugLog(F(_T("Found project '%s' in '%s'"), prjTitle.c_str(), fname.GetFullPath().c_str()));
 
195
            #endif
171
196
 
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))
174
200
                break;
175
201
 
176
202
            project = Manager::Get()->GetProjectManager()->LoadProject(fname.GetFullPath(), false);
177
 
            if (!firstproject) firstproject = project;
178
 
            if (project) registerProject(project->GetTitle(), project);
 
203
            if (!firstproject)
 
204
                firstproject = project;
 
205
 
 
206
            if (!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()));
 
209
                #else
 
210
                Manager::Get()->GetLogManager()->Log(F(_("Warning: Unable to load project '%s' from '%s'"), prjTitle.c_str(), fname.GetFullPath().c_str()));
 
211
                #endif
 
212
            else
 
213
            {
 
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()));
 
216
                #else
 
217
                Manager::Get()->GetLogManager()->Log(F(_("Registering project '%s' from '%s'"), prjTitle.c_str(), fname.GetFullPath().c_str()));
 
218
                #endif
 
219
                registerProject(project->GetTitle(), project);
 
220
                ++count;
 
221
            }
179
222
        }
180
223
        /*
181
224
         * example wanted line:
193
236
 
194
237
    if (firstproject)
195
238
        Manager::Get()->GetProjectManager()->SetProject(firstproject);
 
239
 
196
240
    updateProjects();
197
241
    ImportersGlobals::ResetDefaults();
198
242