28
28
#include " MICmnResources.h"
29
29
#include " Platform.h"
30
30
31
+ // Paths separators
32
+ #ifdef _WIN32
33
+ #define PATH_SEPARATOR " \\ "
34
+ #else
35
+ #define PATH_SEPARATOR " /"
36
+ #endif // _WIN32
37
+ #define RETURNED_PATH_SEPARATOR " /"
38
+
31
39
// ++
32
40
// Details: CMICmnLLDBDebugSessionInfo constructor.
33
41
// Type: Method.
@@ -283,21 +291,31 @@ bool CMICmnLLDBDebugSessionInfo::ResolvePath(const CMIUtilString &vstrUnknown,
283
291
bool bOk = MIstatus::success;
284
292
285
293
CMIUtilString::VecString_t vecPathFolders;
286
- const MIuint nSplits = vwrResolvedPath.Split (" / " , vecPathFolders);
294
+ const MIuint nSplits = vwrResolvedPath.Split (PATH_SEPARATOR , vecPathFolders);
287
295
MIunused (nSplits);
288
296
MIuint nFoldersBack = 1 ; // 1 is just the file (last element of vector)
297
+ CMIUtilString strTestPath;
289
298
while (bOk && (vecPathFolders.size () >= nFoldersBack)) {
290
- CMIUtilString strTestPath;
291
299
MIuint nFoldersToAdd = nFoldersBack;
300
+ strTestPath = " " ;
292
301
while (nFoldersToAdd > 0 ) {
293
- strTestPath += " / " ;
302
+ strTestPath += RETURNED_PATH_SEPARATOR ;
294
303
strTestPath += vecPathFolders[vecPathFolders.size () - nFoldersToAdd];
295
304
nFoldersToAdd--;
296
305
}
297
306
bool bYesAccessible = false ;
298
307
bOk = AccessPath (strTestPath, bYesAccessible);
299
308
if (bYesAccessible) {
300
- vwrResolvedPath = strTestPath;
309
+ #ifdef _WIN32
310
+ if (nFoldersBack == (vecPathFolders.size () - 1 )) {
311
+ // First folder is probably a Windows drive letter ==> must be returned
312
+ vwrResolvedPath = vecPathFolders[0 ] + strTestPath;
313
+ } else {
314
+ #endif
315
+ vwrResolvedPath = strTestPath;
316
+ #ifdef _WIN32
317
+ }
318
+ #endif
301
319
return MIstatus::success;
302
320
} else
303
321
nFoldersBack++;
@@ -306,6 +324,11 @@ bool CMICmnLLDBDebugSessionInfo::ResolvePath(const CMIUtilString &vstrUnknown,
306
324
// No files exist in the union of working directory and debuginfo path
307
325
// Simply use the debuginfo path and let the IDE handle it.
308
326
327
+ #ifdef _WIN32 // Under Windows we must returned vwrResolvedPath to replace "\\"
328
+ // by "/"
329
+ vwrResolvedPath = strTestPath;
330
+ #endif
331
+
309
332
return bOk;
310
333
}
311
334
0 commit comments