Skip to content

Commit

Permalink
src: use starts_with in fs_permission.cc
Browse files Browse the repository at this point in the history
PR-URL: #55811
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Jason Zhang <[email protected]>
Reviewed-By: Deokjin Kim <[email protected]>
  • Loading branch information
IlyasShabi authored Dec 25, 2024
1 parent bd0b704 commit 821b0a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/permission/fs_permission.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ bool is_tree_granted(
std::string resolved_param = node::PathResolve(env, {param});
#ifdef _WIN32
// Remove leading "\\?\" from UNC path
if (resolved_param.substr(0, 4) == "\\\\?\\") {
if (resolved_param.starts_with("\\\\?\\")) {
resolved_param.erase(0, 4);
}

// Remove leading "UNC\" from UNC path
if (resolved_param.substr(0, 4) == "UNC\\") {
if (resolved_param.starts_with("UNC\\")) {
resolved_param.erase(0, 4);
}
// Remove leading "//" from UNC path
if (resolved_param.substr(0, 2) == "//") {
if (resolved_param.starts_with("//")) {
resolved_param.erase(0, 2);
}
#endif
Expand Down

0 comments on commit 821b0a7

Please sign in to comment.