Skip to content

Commit c63b0a6

Browse files
Updating paths to be normalized
1 parent 71dccac commit c63b0a6

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Src/runcpp2/BuildsManager.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ namespace runcpp2
180180
return false;
181181
}
182182

183-
std::string processScriptPathStr = ProcessPath(scriptPath.string());
183+
ghc::filesystem::path cleanScriptPath = scriptPath.lexically_normal();
184+
std::string processScriptPathStr = ProcessPath(cleanScriptPath.string());
184185

185186
if(Mappings.count(processScriptPathStr) > 0)
186187
return true;
@@ -204,7 +205,7 @@ namespace runcpp2
204205

205206
if(counter == MAX_TRIES)
206207
{
207-
ssLOG_ERROR("Failed to get unique hash for " << scriptPath.string() <<
208+
ssLOG_ERROR("Failed to get unique hash for " << cleanScriptPath.string() <<
208209
" after " << MAX_TRIES << " attempts");
209210
return false;
210211
}
@@ -229,7 +230,7 @@ namespace runcpp2
229230
return false;
230231
}
231232

232-
ssLOG_INFO("Build path " << scriptBuildPath << " for " << scriptPath);
233+
ssLOG_INFO("Build path " << scriptBuildPath << " for " << cleanScriptPath);
233234
Mappings[processScriptPathStr] = scriptBuildPathStr;
234235
ReverseMappings[scriptBuildPathStr] = processScriptPathStr;
235236
return true;
@@ -246,7 +247,8 @@ namespace runcpp2
246247
return false;
247248
}
248249

249-
std::string processScriptPathStr = ProcessPath(scriptPath.string());
250+
ghc::filesystem::path cleanScriptPath = scriptPath.lexically_normal();
251+
std::string processScriptPathStr = ProcessPath(cleanScriptPath.string());
250252
if(Mappings.count(processScriptPathStr) == 0)
251253
return true;
252254

@@ -267,7 +269,8 @@ namespace runcpp2
267269
return false;
268270
}
269271

270-
return Mappings.count(ProcessPath(scriptPath.string()));
272+
ghc::filesystem::path cleanScriptPath = scriptPath.lexically_normal();
273+
return Mappings.count(ProcessPath(cleanScriptPath.string()));
271274
}
272275

273276
bool BuildsManager::GetBuildMapping(const ghc::filesystem::path& scriptPath,
@@ -282,14 +285,16 @@ namespace runcpp2
282285
return false;
283286
}
284287

288+
ghc::filesystem::path cleanScriptPath = scriptPath.lexically_normal();
289+
285290
//If it doesn't exist, create the mapping
286-
if(!Mappings.count(ProcessPath(scriptPath.string())))
291+
if(!Mappings.count(ProcessPath(cleanScriptPath.string())))
287292
{
288-
if(!CreateBuildMapping(scriptPath))
293+
if(!CreateBuildMapping(cleanScriptPath))
289294
return false;
290295
}
291296

292-
outPath = BuildDirectory.string() + "/" + Mappings.at(ProcessPath(scriptPath.string()));
297+
outPath = BuildDirectory.string() + "/" + Mappings.at(ProcessPath(cleanScriptPath.string()));
293298
return true;
294299
}
295300

Src/runcpp2/IncludeManager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ namespace runcpp2
150150
{
151151
CO_OVERRIDE_MEMBER_IMPL(OverrideInstance, ghc::filesystem::path, (sourceFile));
152152

153-
std::size_t pathHash = std::hash<std::string>{}(sourceFile.string());
153+
ghc::filesystem::path cleanSourceFile = sourceFile.lexically_normal();
154+
std::size_t pathHash = std::hash<std::string>{}(cleanSourceFile.string());
154155
return IncludeRecordDir / (std::to_string(pathHash) + ".Includes");
155156
}
156157
}

0 commit comments

Comments
 (0)