Skip to content

Commit ad3d857

Browse files
IlyasShabiaduh95
authored andcommittedJan 31, 2025
src: use starts_with in fs_permission.cc
PR-URL: #55811 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
1 parent 0f7aed8 commit ad3d857

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/permission/fs_permission.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ bool is_tree_granted(
5858
std::string resolved_param = node::PathResolve(env, {param});
5959
#ifdef _WIN32
6060
// Remove leading "\\?\" from UNC path
61-
if (resolved_param.substr(0, 4) == "\\\\?\\") {
61+
if (resolved_param.starts_with("\\\\?\\")) {
6262
resolved_param.erase(0, 4);
6363
}
6464

6565
// Remove leading "UNC\" from UNC path
66-
if (resolved_param.substr(0, 4) == "UNC\\") {
66+
if (resolved_param.starts_with("UNC\\")) {
6767
resolved_param.erase(0, 4);
6868
}
6969
// Remove leading "//" from UNC path
70-
if (resolved_param.substr(0, 2) == "//") {
70+
if (resolved_param.starts_with("//")) {
7171
resolved_param.erase(0, 2);
7272
}
7373
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.