Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9400e2d7
Commit
9400e2d7
authored
Nov 01, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed SearchPath to handle a ';'-separated path as first argument.
parent
ddcc85ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
directory.c
files/directory.c
+22
-22
No files found.
files/directory.c
View file @
9400e2d7
...
...
@@ -489,17 +489,20 @@ static BOOL DIR_TryPath( const DOS_FULL_NAME *dir, LPCSTR name,
* DIR_TryEnvironmentPath
*
* Helper function for DIR_SearchPath.
* Search in the specified path, or in $PATH if NULL.
*/
static
BOOL
DIR_TryEnvironmentPath
(
LPCSTR
name
,
DOS_FULL_NAME
*
full_name
)
static
BOOL
DIR_TryEnvironmentPath
(
LPCSTR
name
,
DOS_FULL_NAME
*
full_name
,
LPCSTR
envpath
)
{
LPSTR
path
,
next
,
buffer
;
BOOL
ret
=
FALSE
;
INT
len
=
strlen
(
name
);
DWORD
size
=
GetEnvironmentVariableA
(
"PATH"
,
NULL
,
0
)
;
DWORD
size
;
size
=
envpath
?
strlen
(
envpath
)
+
1
:
GetEnvironmentVariableA
(
"PATH"
,
NULL
,
0
);
if
(
!
size
)
return
FALSE
;
if
(
!
(
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
return
FALSE
;
if
(
!
GetEnvironmentVariableA
(
"PATH"
,
path
,
size
))
goto
done
;
if
(
envpath
)
strcpy
(
path
,
envpath
);
else
if
(
!
GetEnvironmentVariableA
(
"PATH"
,
path
,
size
))
goto
done
;
next
=
path
;
while
(
!
ret
&&
next
)
{
...
...
@@ -563,7 +566,6 @@ static BOOL DIR_TryModulePath( LPCSTR name, DOS_FULL_NAME *full_name, BOOL win32
DWORD
DIR_SearchPath
(
LPCSTR
path
,
LPCSTR
name
,
LPCSTR
ext
,
DOS_FULL_NAME
*
full_name
,
BOOL
win32
)
{
DWORD
len
;
LPCSTR
p
;
LPSTR
tmp
=
NULL
;
BOOL
ret
=
TRUE
;
...
...
@@ -578,39 +580,37 @@ DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
path
=
NULL
;
/* Ignore path if name already contains a path */
if
(
path
&&
!*
path
)
path
=
NULL
;
/* Ignore empty path */
len
=
strlen
(
name
);
if
(
ext
)
len
+=
strlen
(
ext
);
if
(
path
)
len
+=
strlen
(
path
)
+
1
;
/* Allocate a buffer for the file name and extension */
if
(
path
||
ext
)
if
(
ext
)
{
DWORD
len
=
strlen
(
name
)
+
strlen
(
ext
);
if
(
!
(
tmp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
1
)))
{
SetLastError
(
ERROR_OUTOFMEMORY
);
return
0
;
}
if
(
path
)
{
strcpy
(
tmp
,
path
);
strcat
(
tmp
,
"
\\
"
);
strcat
(
tmp
,
name
);
}
else
strcpy
(
tmp
,
name
);
if
(
ext
)
strcat
(
tmp
,
ext
);
strcpy
(
tmp
,
name
);
strcat
(
tmp
,
ext
);
name
=
tmp
;
}
/* If we have an explicit path, everything's easy */
if
(
path
||
(
*
name
&&
(
name
[
1
]
==
':'
))
||
strchr
(
name
,
'/'
)
||
strchr
(
name
,
'\\'
))
/* If the name contains an explicit path, everything's easy */
if
((
*
name
&&
(
name
[
1
]
==
':'
))
||
strchr
(
name
,
'/'
)
||
strchr
(
name
,
'\\'
))
{
ret
=
DOSFS_GetFullName
(
name
,
TRUE
,
full_name
);
goto
done
;
}
/* Search in the specified path */
if
(
path
)
{
ret
=
DIR_TryEnvironmentPath
(
name
,
full_name
,
path
);
goto
done
;
}
/* Try the path of the current executable (for Win32 search order) */
if
(
win32
&&
DIR_TryModulePath
(
name
,
full_name
,
win32
))
goto
done
;
...
...
@@ -635,7 +635,7 @@ DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
/* Try all directories in path */
ret
=
DIR_TryEnvironmentPath
(
name
,
full_name
);
ret
=
DIR_TryEnvironmentPath
(
name
,
full_name
,
NULL
);
done:
if
(
tmp
)
HeapFree
(
GetProcessHeap
(),
0
,
tmp
);
...
...
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