Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
TortoiseGit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
288
Issues
288
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
8
Merge Requests
8
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TortoiseGit
TortoiseGit
Commits
95891f3d
Commit
95891f3d
authored
Jul 31, 2015
by
Sven Strickroth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace FileExists (which uses "stat") with PathFileExists
Signed-off-by:
Sven Strickroth
<
email@cs-ware.de
>
parent
4e607345
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
src/Git/Git.cpp
src/Git/Git.cpp
+7
-13
No files found.
src/Git/Git.cpp
View file @
95891f3d
...
...
@@ -57,12 +57,6 @@ static LPCTSTR nextpath(const wchar_t* path, wchar_t* buf, size_t buflen)
return
(
path
!=
base
)
?
path
:
NULL
;
}
static
inline
BOOL
FileExists
(
LPCTSTR
lpszFileName
)
{
struct
_stat
st
;
return
_tstat
(
lpszFileName
,
&
st
)
==
0
;
}
static
CString
FindFileOnPath
(
const
CString
&
filename
,
LPCTSTR
env
,
bool
wantDirectory
=
false
)
{
TCHAR
buf
[
MAX_PATH
]
=
{
0
};
...
...
@@ -83,7 +77,7 @@ static CString FindFileOnPath(const CString& filename, LPCTSTR env, bool wantDir
else
break
;
if
(
FileExists
(
buf
))
if
(
Path
FileExists
(
buf
))
{
if
(
wantDirectory
)
pfin
[
1
]
=
0
;
...
...
@@ -115,7 +109,7 @@ static BOOL FindGitPath()
{
// prefer cmd directory as early Git for Windows 2.x releases only had this
CString
installRoot
=
CGit
::
ms_LastMsysGitDir
.
Mid
(
0
,
CGit
::
ms_LastMsysGitDir
.
GetLength
()
-
12
)
+
_T
(
"
\\
cmd
\\
git.exe"
);
if
(
FileExists
(
installRoot
))
if
(
Path
FileExists
(
installRoot
))
CGit
::
ms_LastMsysGitDir
=
CGit
::
ms_LastMsysGitDir
.
Mid
(
0
,
CGit
::
ms_LastMsysGitDir
.
GetLength
()
-
12
)
+
_T
(
"
\\
cmd"
);
}
if
(
CGit
::
ms_LastMsysGitDir
.
GetLength
()
>
4
&&
CGit
::
ms_LastMsysGitDir
.
Right
(
4
)
==
_T
(
"
\\
cmd"
))
...
...
@@ -123,7 +117,7 @@ static BOOL FindGitPath()
// often the msysgit\cmd folder is on the %PATH%, but
// that git.exe does not work, so try to guess the bin folder
CString
binDir
=
CGit
::
ms_LastMsysGitDir
.
Mid
(
0
,
CGit
::
ms_LastMsysGitDir
.
GetLength
()
-
4
)
+
_T
(
"
\\
bin
\\
git.exe"
);
if
(
FileExists
(
binDir
))
if
(
Path
FileExists
(
binDir
))
CGit
::
ms_LastMsysGitDir
=
CGit
::
ms_LastMsysGitDir
.
Mid
(
0
,
CGit
::
ms_LastMsysGitDir
.
GetLength
()
-
4
)
+
_T
(
"
\\
bin"
);
}
return
TRUE
;
...
...
@@ -139,7 +133,7 @@ static CString FindExecutableOnPath(const CString& executable, LPCTSTR env)
if
(
executable
.
GetLength
()
<
4
||
executable
.
Find
(
_T
(
".exe"
),
executable
.
GetLength
()
-
4
)
!=
executable
.
GetLength
()
-
4
)
filename
+=
_T
(
".exe"
);
if
(
FileExists
(
filename
))
if
(
Path
FileExists
(
filename
))
return
filename
;
filename
=
FindFileOnPath
(
filename
,
env
);
...
...
@@ -2029,7 +2023,7 @@ int CGit::FindAndSetGitExePath(BOOL bFallback)
{
CRegString
msysdir
=
CRegString
(
REG_MSYSGIT_PATH
,
_T
(
""
),
FALSE
);
CString
str
=
msysdir
;
if
(
!
str
.
IsEmpty
()
&&
FileExists
(
str
+
_T
(
"
\\
git.exe"
)))
if
(
!
str
.
IsEmpty
()
&&
Path
FileExists
(
str
+
_T
(
"
\\
git.exe"
)))
{
CGit
::
ms_LastMsysGitDir
=
str
;
return
TRUE
;
...
...
@@ -2067,9 +2061,9 @@ int CGit::FindAndSetGitExePath(BOOL bFallback)
}
if
(
!
str
.
IsEmpty
())
{
if
(
FileExists
(
str
+
_T
(
"
\\
bin
\\
git.exe"
)))
if
(
Path
FileExists
(
str
+
_T
(
"
\\
bin
\\
git.exe"
)))
str
+=
_T
(
"
\\
bin"
);
else
if
(
FileExists
(
str
+
_T
(
"
\\
cmd
\\
git.exe"
)))
// only needed for older Git for Windows 2.x packages
else
if
(
Path
FileExists
(
str
+
_T
(
"
\\
cmd
\\
git.exe"
)))
// only needed for older Git for Windows 2.x packages
str
+=
_T
(
"
\\
cmd"
);
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment